Discussion Locked

What's the correct way to store a date??

0 helpful
4 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I'm using a

4 replies

by mukul_gandhi

You have to read date in asp as -
strIBUSKEY = Request.QueryString("ibuskey")
But u must make sure that date value is entered in html form in correct format. Input format of date will depend on the database ur using. e.g in Oracle, u must enter date by default as DD-MON-YYYY. If u choose some other input format, u have to convert the date input in asp appropriately e.g using to_date function in Oracle. You must give instruction in HTML page for the format u want in input.
Details for other databases are different. Check with them individually.

regards
-mukul

by shadowtraitor

hey
You should tell the users the format you want or gather the date string from seprate input boxes such a select combo box for the month, and 2 input boxes for the year and date.
Once you have the datestring you can convert it to be of datetime format using the Vbscript function call as follows
datestring = cdate(datestring)
in you SQL statement ensure that the you enclose the datestring with two pound signs(#) as in sample below
SQLSTRING = "INSERT INTO Timesheet (Date)values ("& datestring & "#)"
if you goto www.itknowledge.com you will find some good books on ASP and VB script.

Hope I helped

This discussion is closed to new replies.