date and time problem

Discussion in 'ASP General' started by dave, Jan 15, 2004.

  1. dave

    dave Guest

    I have written asp code to insert current date and time.
    my database is in sql server 2000.
    this is the sql query that i m using.

    sql = "INSERT INTO tblDailyVisitLog
    (UserID,DailyDate,DailyTime) VALUES
    ('test',"&formatdatetime(date,2)&",'"&formatdatetime
    (date,3)&"')"

    But when I checked in the database in date and time field
    it shows "1/1/1900" in both fields.

    any help would be appreciated..
    thanx.
    david
    dave, Jan 15, 2004
    #1
    1. Advertising

  2. dave

    Dan Boylett Guest

    "dave" <> wrote in message
    news:062c01c3db2e$22daf7a0$...
    > I have written asp code to insert current date and time.
    > my database is in sql server 2000.
    > this is the sql query that i m using.
    >
    > sql = "INSERT INTO tblDailyVisitLog
    > (UserID,DailyDate,DailyTime) VALUES
    > ('test',"&formatdatetime(date,2)&",'"&formatdatetime
    > (date,3)&"')"
    >
    > But when I checked in the database in date and time field
    > it shows "1/1/1900" in both fields.
    >


    REsponse.write your SQL statement so you can see exactly what is being
    executed against the database
    Dan Boylett, Jan 15, 2004
    #2
    1. Advertising

  3. dave

    CJM Guest

    What date format are you using? ie where are you based? US? UK? Other?

    It's always a good idea to use ISO date formats, i.e. 2004-01-15 or
    20040115.

    http://support.microsoft.com/?kbid=229690
    http://www.aspfaq.com/show.asp?id=2260

    Chris

    "dave" <> wrote in message
    news:062c01c3db2e$22daf7a0$...
    > I have written asp code to insert current date and time.
    > my database is in sql server 2000.
    > this is the sql query that i m using.
    >
    > sql = "INSERT INTO tblDailyVisitLog
    > (UserID,DailyDate,DailyTime) VALUES
    > ('test',"&formatdatetime(date,2)&",'"&formatdatetime
    > (date,3)&"')"
    >
    > But when I checked in the database in date and time field
    > it shows "1/1/1900" in both fields.
    >
    > any help would be appreciated..
    > thanx.
    > david
    CJM, Jan 15, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matt
    Replies:
    1
    Views:
    564
    Matthew Speed
    Nov 8, 2003
  2. Chris Berg
    Replies:
    0
    Views:
    761
    Chris Berg
    Oct 27, 2003
  3. Peter Grison

    Date, date date date....

    Peter Grison, May 28, 2004, in forum: Java
    Replies:
    10
    Views:
    3,178
    Michael Borgwardt
    May 30, 2004
  4. Keith Cochrane
    Replies:
    2
    Views:
    595
    Keith Cochrane
    Aug 6, 2006
  5. Summu82
    Replies:
    5
    Views:
    840
    Richard Heathfield
    Jun 7, 2006
Loading...

Share This Page