Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Constructing valid date from 3 sets of numbers 1

Status
Not open for further replies.

KingElvis

Programmer
Jan 28, 2004
39
0
0
IL
I wish to convert 3 numbers (for example, 10, 5, 2004) to a date and then subtract that date from today's date.

I tried writing something like this

enteredDate = cInt(Request.Form("smonth")) & "/" & cInt(Request.Form("sday")) & "/" & cInt(Request.Form("syear"))
response.write date - enteredDate


However I get an error. Is my code for 'enteredDate' a valid date, or is it simply a string? If it is a string, then how do I construct it as a date?
 
wrap it in a cdate() and use the dateadd function
 
Or use DateSerial and save yourself the 4 concatenations and conversion.

-T

barcode_1.gif
 
Didn't think of that, Tarwn. Much simpler.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top