Is there a Date() function that includes time?
I'm using the Date() function to ad the date to messages users input via a form so that they can be sorted by the order they were received when retrieved from the database. The problem is I'm getting numerous posts each day so a calendar date alone isn't enough. I need date PLUS TIME to get an accurate sort. Is there a built-in function in ASP that will give me date and time?
Here's the code that writes the message to the database:
objRS2("User") = ... 'omited because irrelevant to ?
objRS2("Msg") = Request.Form("Msg") 'gets message from form
objRS2("Date") = Date() 'ads calendar date, NEEDS TIME!
The code that retrieves and sorts messages is:
objComm.CommandText = "SELECT * FROM PilotMessages WHERE Date-Date()>-20 ORDER BY Date DESC"
objComm.CommandType = adCmdText
Set objRS = objComm.Execute
The SELECT statement should disregard messages over 20 days old and sort messages by date AND TIME. This code works fine except messages with the same date appear in random order rather than the order received on that day.
Thanks in advance.