Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 26th, 2004, 03:38 PM
Registered User
 
Join Date: Jan 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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.AddNew
objRS2("User") = ... 'omited because irrelevant to ?
objRS2("Msg") = Request.Form("Msg") 'gets message from form
objRS2("Date") = Date() 'ads calendar date, NEEDS TIME!
objRS2.Update

The code that retrieves and sorts messages is:
...portion ommited....
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.

Please help!
Thanks in advance.
Tim
 
Old April 27th, 2004, 03:10 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

Use the Now function, that gives date and time.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Extracting Time from Date/Time Navy1991_1 XSLT 2 June 3rd, 2008 12:03 PM
date and time in EST time zone anboss XSLT 1 May 21st, 2008 01:42 PM
How to retieve only the date not date and time debjanib ASP.NET 1.0 and 1.1 Professional 2 July 25th, 2006 01:10 PM
Anyone expert in time function itHighway Classic ASP Basics 6 May 3rd, 2005 10:38 PM
insert system date. no date and time jimmy Access VBA 6 November 20th, 2003 01:11 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.