Help on Date format ???

G

Guest

Dear all,

I have a web application build with ASP 1.1 which has a querry form based on
fields where users need to enter a date/time value for data collection.

On my Web server the date time foprmat is set with US (english).

The final querry will be something like :
" select * from Table 1 where DATE_TIME > @DateTimeParam"

What is the way to control that the value enter in the DAte/tiome tex box
correspond to proper date format and will return correct information based on
server date/time format ?

For example if I pass the date in MM/dd/yyyy and my server is set o use
dd/MM/yyyy, then if you enter 2/3/2006 or its interprated on the server as
3/2/2006 I will not have correct data.

How can I check that ??

Thanks for your help
regards

Serge
 
F

Flinky Wisty Pomm

You can't really. If they type in a valid date, then you haven't any
way of telling what the user was thinking at the time. This assumes the
user was thinking.

If you want to avoid the problem you can use either a date/time picker
control, or the old fashioned way, separate dropdownlists for
Day/Month/Year.

Or you can always refuse any format except yyyy-mm-dd, but your users
will think you're crazy.
 
B

blackstaronline.net

I just built an application where the date they entered was a very
important piece of info for the account. It was for escrow/home buying.
The date entered was a close of escrow date and many people relied on
it. There were also certain guide lines to it. It couldn't be more than
60 days old, and it couldn't be a future date.

I ran into the same situation as you when I used a single textbox
relying on the user entering in a correct date. I finally found it was
easier to populate 3 drop downs with the appropriate data. Now it works
great. First they have to select the month, then based on the month
selection it fills the day selection with the appropriate amount of
days for that month, example: 31 for January, 28 for February (29 on a
leap year), etc. That way you will ALWAYS get a valid date in the same
format as you expect it in.

Hope it helps,
Jeremy Reid
http://hgtit.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,060
Latest member
BuyKetozenseACV

Latest Threads

Top