i have formular in my ASP code as follows TimeNow = DateAdd("h", 10, Time)
Most of the time, it gives me correct results. But sometimes, it gives me 31/12/1899 07:37:33 How do i make sure, i get only 07:37:33 and not the portion of the date? Thank you!
MICAH
Reply from Richard Rost:
That's interesting. I've never run into that before. Looks like you're ending up with a NEGATIVE date value somehow - because date values are actually the number of seconds since Jan 1st, 1900. NORMALLY, with a valid date, you could strip off the date portion by saying:
CurrentTimeOnly = Now()-Date()
That would give you just the hours, minutes, and seconds. However, since you're getting dates before 1/1/1900, you'll have to get creative and break it up into HOUR(), MINUTE(), SECOND() and then use the TIMESERIAL() function to put them back together into a valid TIME datatype.
Strange indeed.
Sorry, only students may add comments.
Click here for more
information on how you can set up an account.
If you are a Visitor, go ahead and post your reply as a
new comment, and we'll move it here for you
once it's approved. Be sure to use the same name and email address.
This thread is now CLOSED. If you wish to comment, start a NEW discussion in
Active Server Pages Forum.