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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Local date/time - Server's date/time

Status
Not open for further replies.

ojf

Instructor
Sep 27, 2000
49
NO
Is there an easy way to use client date/time in an asp page.
I normally use <%myDate=Now()%> and as the server is in the US then the date/time will not be correct as the US is 7 hours behind us. It's of course possible to add 7/24 to now() like this: <%myDate=Now()+7/24%> and that will be correct for me but not for users in another time zone.

The database rquires the date like this: mm/dd/yyyy
I want to use dd.mm.yyyy and when I enter 24.12.2001 then I get an error. If I enter 12.24.2001 it is accepted. Is there an easy way round this problem?
 
If the client computer needs to submit a date you should use client side vb script.
The function now() run by client side scripting will return the date time as it is set on the client computer.
To put this date time in mm/dd/yyyy hh:mm format you can run this in the onsubmit event of the form:
myForm.myHiddenDateTextField.value = day(now()) & &quot;/&quot; & month(now()) & &quot;/&quot; & year(now()) & &quot; &quot; & hour(now()) & &quot;:&quot; & minute(now())

I have made a calendar wich only works on IE where a user has to pick a date.
It will be put in US date regardless what the users IE language or regional settings are.
the url for this page is:
It is a bit slow and yahoo has added some script in the bottom, I suggest you save the source of the url and the pupup window and remove the yahoo script in the bottom.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top