#1
  1. Contributing User
    ASP Explorer (0 - 99 posts)

    Join Date
    Feb 2004
    Posts
    72
    Rep Power
    16

    ASP displaying a date instead of a time?


    I'm using a mySQL database with an ASP page that is supposed to edit that database. The problem is that I'm trying to insert a null value into a time field on the database. It inserts fine and when I look at it in mySQL CC it is 00:00:00. But when I select it, the time is displayed as todays date. What is going on!?
    Here is the part that gets the records:
    Code:
     set rs = server.createobject("adodb.recordset")
    rs.open "SELECT eDate, eNumber, eTitle, eSuper, eTime,Event FROM eventdb order by eDate asc", conn
    do while not rs.eof
     if cdate(rs("eDate")) = curDate then
      Ar1(i,0) = rs("eNumber")
      Ar1(i,1) = rs("eTitle")
      Ar1(i,2) = rs("eDate")
      Ar1(i,3) = rs("eSuper")
      Ar1(i,5) = rs("Event")
      if rs("eTime") = null then
       Ar1(i,6) = "CHECKED"
       Ar1(i,4) = "All Day"
      else
       Ar1(i,6) = ""
       Ar1(i,4) = rs("eTime")
      end if
      response.write(Ar1(i,6) & "|" & Ar1(i,4))
      response.end
      Ar1(i,1) = reverseReplace(Ar1(i,1))
      Ar1(i,3) = reverseReplace(Ar1(i,3))
      Ar1(i,5) = reverseReplace(Ar1(i,5))
      i = i + 1
     end if
     rs.movenext
    loop
    Even when I try to get just the time from it, when the field ISN'T null, it displays the date before it so I have to use a right(string, 10) statement to get just the date. What is going on?!
    If in doubt, google it!
  2. #2
  3. Contributing User
    ASP Explorer (0 - 99 posts)

    Join Date
    Feb 2004
    Posts
    72
    Rep Power
    16
    Okay that problem is solved, but my time field won't take null as a value. When it sees it, it turns it into 00:00:00, which is 12:00. I don't want it to be 12:00 i want it to be null. Any suggestions?
    Thanks in advance.
  4. #3
  5. No Profile Picture
    Contributing User
    ASP Explorer (0 - 99 posts)

    Join Date
    Feb 2004
    Posts
    91
    Rep Power
    16

    Re:mySql problem


    Hi
    Can you use "text" datatype instead of date type in the database.
    Because anyway you are doing conversion in the ASP code.
    And secondly it will be able to take Null values as well.

    Regards
    brlele

Similar Threads

  1. Time tracking / Date time function with timezones
    By Ralph in forum ASP Development
    Replies: 2
    Last Post: January 5th, 2004, 11:54 PM
  2. Date and time
    By thehen in forum Programming Help
    Replies: 0
    Last Post: October 16th, 2003, 02:17 AM
  3. Need help with displaying time format
    By Steve Schofield in forum ASP Development
    Replies: 0
    Last Post: April 10th, 2002, 11:13 PM
  4. controlling date and time formats in an asp-generated email
    By Steve Schofield in forum ASP Development
    Replies: 1
    Last Post: January 22nd, 2001, 01:04 PM
  5. now() function not displaying correct time
    By Steve Schofield in forum ASP Development
    Replies: 1
    Last Post: August 27th, 2000, 04:34 PM

IMN logo majestic logo threadwatch logo seochat tools logo