int to char ... date problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Robin

    int to char ... date problem

    I know that you would use cInt(n) to convert a string to an integer.
    How do you convert an integer to a string?
    I have a varChar field in a database that I am inserting a date field
    (needs to be a char field).
    The date is formatted like so:
    y = year(now())
    m = month(now())
    d = day(now())
    vNow = Y & "-" & M & "-" & D
    To me this looks like it should come up with
    vNow = 2004-6-25
    But instead it is actually doing the math and coming up with
    vNow = 1973
  • Dave Anderson

    #2
    Re: int to char ... date problem

    Robin wrote:[color=blue]
    > I have a varChar field in a database that I am inserting a date
    > field (needs to be a char field).[/color]

    This makes no sense to me whatsoever. On one hand, it sounds as though you
    want to convert a VARCHAR to a CHAR. That has nothing at all to do with ASP.
    Beyond that, it is not clear if you are inserting a date (the abstract
    notion of a date, that is) into a VARCHAR, or attempting to convert a
    VARCHAR to a DATE.


    --
    Dave Anderson

    Unsolicited commercial email will be read at a cost of $500 per message. Use
    of this email address implies consent to these terms. Please do not contact
    me directly or ask me to contact you directly for assistance. If your
    question is worth asking, it's worth posting.


    Comment

    • Aaron [SQL Server MVP]

      #3
      Re: int to char ... date problem

      > I know that you would use cInt(n) to convert a string to an integer.[color=blue]
      > How do you convert an integer to a string?[/color]

      CStr() ?
      [color=blue]
      > I have a varChar field in a database that I am inserting a date field[/color]

      What? You're inserting a date value into a VARCHAR column? WHY?

      Is this Access, SQL Server, FoxPro, MySQL, ...? What version?
      [color=blue]
      > But instead it is actually doing the math and coming up with
      > vNow = 1973[/color]

      Can you show the actual code that causes this to happen?

      --

      (Reverse address to reply.)



      Comment

      Working...