Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Basics
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 26th, 2004, 03:38 PM
Registered User
Join Date: Jan 2004
Location: Fort Wayne, IN, USA.
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("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:
...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.
Reply With Quote
  #2 (permalink)  
Old April 27th, 2004, 03:10 AM
Friend of Wrox
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post

Use the Now function, that gives date and time.
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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

All times are GMT -4. The time now is 07:33 AM.

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