[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 412
  • Last Modified:

How to add one hour to server time in classic ASP?

Hi Experts,
I'm using the following to get the date and time on my web page:
<%=FormatDateTime(Date,1)%>&nbsp;<%=FormatDateTime(now,3)%>
My problem is that the server is in a different time zone and I need to add one hour to the time displayed on my page.
I'd appreciate your help.
0
baxtalo
Asked:
baxtalo
  • 2
2 Solutions
 
sammySeltzerCommented:
You can do this:

timevar = DateAdd("h",1,Time())

This adds one hour to time.

You can also use javascript to display date and time based on the time zone someone is on.

<script type="text/javascript">
   var dt = new Date('September 13, 2011 10:28 PM UTC');
   var formattedDateTime = dt.toLocaleString();
   document.write(formattedDateTime);
</script>

UTC determines your zone and toLocalString() function displays the date and time based on your time zone.

FInally, check this site out.

http://www.bullschmidt.com/devtip-timezones.asp

0
 
sammySeltzerCommented:
You could also try this:

DATEADD(hh,1,getdate())

or

<%
datevar = DATEADD("h",1,Now())
response.write datevar
%>

lots of options
0
 
baxtaloAuthor Commented:
Thank you very much; this solved my problem.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now