How do I add 1 hour to a time\date stamp (using Now())?

B

Brave

Hello all,

I have an ASP form with a form field that populates the current date
by using the following:

<%=Now()%>

The problem is that the server is located in a eastern time zone and
the users are 1 hour ahead.

How can I add 1 hour to that field. I assume <%=Now() + 1%> would add
an entire day.

Can someone offer an example of the correct way to accomplish this?

Thanks so much!!
 
A

Adrienne Boswell

Gazing into my crystal ball I observed Brave <[email protected]>
writing in @v36g2000yqv.googlegroups.com:
Hello all,

I have an ASP form with a form field that populates the current date
by using the following:

<%=Now()%>

The problem is that the server is located in a eastern time zone and
the users are 1 hour ahead.

How can I add 1 hour to that field. I assume <%=Now() + 1%> would add
an entire day.

Can someone offer an example of the correct way to accomplish this?

Thanks so much!!

atthetonethetimewillbe = dateadd("h",1,now())

However, the important thing here is what time the data goes into your
server. Probably best thing to do would to convert the time to UTC or
GMT.
 
E

Evertjan.

Adrienne Boswell wrote on 25 jul 2009 in
microsoft.public.inetserver.asp.general:
Gazing into my crystal ball I observed Brave <[email protected]>
writing in @v36g2000yqv.googlegroups.com:


atthetonethetimewillbe = dateadd("h",1,now())

However, the important thing here is what time the data goes into your
server. Probably best thing to do would to convert the time to UTC or
GMT.

good advice!

============================
<% ' vbscript assumed
NowUTC = DateAdd("h", TimezoneOffset, Now)
%>

<script language='javascript' runat='server'>
var TimezoneOffset = new Date().getTimezoneOffset()/60;
</script>
============================

Assuming the timezoneoffset of the server is correctly set,
but that will show at the first try.
 
B

Brave

Adrienne Boswell wrote on 25 jul 2009 in
microsoft.public.inetserver.asp.general:








good advice!

============================
<% ' vbscript assumed
NowUTC = DateAdd("h", TimezoneOffset, Now)
%>

<script language='javascript' runat='server'>
   var TimezoneOffset = new Date().getTimezoneOffset()/60;
</script>
============================

Assuming the timezoneoffset of the server is correctly set,
but that will show at the first try.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)- Hide quoted text -

- Show quoted text -

Thanks so much for taking the time.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top