Bullschmidt.com


     Home
     Web Database Concept
     How We Work Together
     Bio
     Web Database Sample
     Classic ASP Design Tips
     Bar Chart Tool
     Web Design Resources
     Access Database Sample

Classic ASP Design Tips
Time Zones
These are opinions of J. Paul Schmidt, MBA.
No warranties are either expressed or implied.
To Use Paul's Services: Paul@Bullschmidt.com

Since an organization and its Web host may not reside in the same time zone (much less the same country) create a way to adjust the Web host's date/time to be the same as the organization's.

On an included page place code like the following:
<%
mintServerToOrgHourOffset = 3 ' Server is Pacific Time and org is Eastern Time.
mvarOrgCurDtTime = DateAdd("H", mintServerToOrgHourOffset, Now())
mvarOrgCurDt = DateValue(mvarOrgCurDtTime)
mvarOrgCurTime = TimeValue(mvarOrgCurDtTime)
%>

Then on any page for the current date/time istead of:
<%= Now() %>

Use:
<%= mvarOrgCurDtTime %>

And for the current date instead of:
<%= Date() %>

Use:
<%= mvarOrgCurDt %>

And for the current time instead of:
<%= Time() %>

Use:
<%= mvarOrgCurTime %>

And the above could be used in functions such as FormatDateTime() (or in custom functions with specific formats):
<%= FormatDateTime(mvarOrgCurDt, vbGeneralDate) %>
<%= FormatDateTime(mvarOrgCurDt, vbLongDate) %>
<%= FormatDateTime(mvarOrgCurDt, vbShortDate) %>
<%= FormatDateTime(mvarOrgCurTime, vbLongTime) %>
<%= FormatDateTime(mvarOrgCurTime, vbShortTime) %>





To Use Paul's Services:
Paul@Bullschmidt.com

Let's put some data on the Web!
Copyright © 2000-2014
J. Paul Schmidt, MBA
Freelance Web and Database Developer
All Rights Reserved

Privacy Policy