Forums
This topic is locked
Want to display current time as U.S. Eastern Time
04 Sep 2001 23:27:03 B. B. posted:
Hello! Have a page which is currently displaying the current date and time using the ASP Now() format. The time is currently in Central time which is where the web host servers reside and it looks like it picks up that time istead of the local desktop machine time.
Does the Now() function indeed pick up the current time from the server and if so is there a function to pick it up from the local desktop machine or deos some type of Javascript function need to be manually coded to translate the central time to eastern time?
Hopefully someone has run into this previously. Would appreciate greatly any help. Thanks!
Replies
Replied 05 Sep 2001 01:35:13
05 Sep 2001 01:35:13 Owen Eastwick replied:
Use the DateAdd VBScript function to correct the time.
Something Like this:
varCorrectedTime = DateAdd("h", 6,Now()) ' This will add 6 hours to the server time.
varCorrectedTime = DateAdd("h", -6,Now()) ' This will subtract 6 hours from the server time.
varCorrectedTime = DateAdd("d", -6,Now()) ' This will subtract 6 days from the server time.
varCorrectedTime = DateAdd("w", -6,Now()) ' This will subtract 6 weeks from the server time.
varCorrectedTime = DateAdd("m", -6,Now()) ' This will subtract 6 months from the server time.
Here's a very handy link to Microsoft Scripting Technologies:
msdn.microsoft.com/scripting/default.htm
From here you can download and install the VBScript and Jscript Reference, searchable Help files.
Regards
Owen.
www.tdsf.co.uk/tdsfdemo
Something Like this:
varCorrectedTime = DateAdd("h", 6,Now()) ' This will add 6 hours to the server time.
varCorrectedTime = DateAdd("h", -6,Now()) ' This will subtract 6 hours from the server time.
varCorrectedTime = DateAdd("d", -6,Now()) ' This will subtract 6 days from the server time.
varCorrectedTime = DateAdd("w", -6,Now()) ' This will subtract 6 weeks from the server time.
varCorrectedTime = DateAdd("m", -6,Now()) ' This will subtract 6 months from the server time.
Here's a very handy link to Microsoft Scripting Technologies:
msdn.microsoft.com/scripting/default.htm
From here you can download and install the VBScript and Jscript Reference, searchable Help files.
Regards
Owen.
www.tdsf.co.uk/tdsfdemo
Replied 05 Sep 2001 05:23:34
05 Sep 2001 05:23:34 B. B. replied:
Hey Owen! This worked like a charm. Added one hour to the central time and now it shows the correct eastern time. Very much appreciate the help. Thanks!