Solved

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

Posted on 2011-09-13
3
342 Views
Last Modified: 2012-05-12
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
Comment
Question by:baxtalo
  • 2
3 Comments
 
LVL 28

Accepted Solution

by:
sammySeltzer earned 500 total points
ID: 36533717
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
 
LVL 28

Assisted Solution

by:sammySeltzer
sammySeltzer earned 500 total points
ID: 36533738
You could also try this:

DATEADD(hh,1,getdate())

or

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

lots of options
0
 

Author Closing Comment

by:baxtalo
ID: 36533764
Thank you very much; this solved my problem.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Smart quotes being changed on insert 9 49
pass url parameter as session 9 48
Field that has HTML displays the code instead of the text in html 16 60
JSON error 4 50
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now