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!

1 hour server time difference 1

Status
Not open for further replies.

onressy

Programmer
Mar 7, 2006
421
CA
Hi i'm display the day and time on a home page like so:
<%= FormatDateTime(Date, 1)%>&nbsp;<%=DateAdd("h",-1,time())%>

I'm using -1 for the time because the server location is 1 hour off homepage location. How can i format the date so that it reflects this 1 hour difference as well?

Thanks
 
One hour off from which time zone? Are you planning on having visitors from any time zones other than the one you're currently in?

Lee
 
You could align the time with the server first using

net time \\server /set

Have both the server and client got daylight savings switched on?
 
aligning the time is not the issue, i have teh time correct in setting it -1 from server time. When a user goes to the website for a city, i want to display the city time and date. My issue is with the date, i'm grabbing the date from the server but when 12:00 hits in the city, the <%= FormatDateTime(Date, 1)%>&nbsp;<%=DateAdd("h",-1,time())%>

will show the corect time buit the incorrect date. any suggestions? Thanks
 
You need to subtract 1 hour from the DateTime. Date returns the date. Time returns the time. Now returns both, so....

[tt][blue]<%= DateAdd("h", -1, Now)%>[/blue][/tt]

I don't have IIS handy at the moment, so I can't help you with the formatting, but that part should be pretty easy for you.




-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
LCID Property

[sub]____________ signature below ______________
The worst mistake you'll ever make is to do something simply the way you know how while ignoring the way it should be done[/sub]
 
Thanks gmmastros, onpnt thanks!... nifty info
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top