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

Discussion in 'ASP General' started by Brave, Jul 25, 2009.

  1. Brave

    Brave Guest

    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!!
     
    Brave, Jul 25, 2009
    #1
    1. Advertising

  2. Gazing into my crystal ball I observed Brave <>
    writing in news:82d27840-c140-4af3-8e33-d334f867e339
    @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.

    --
    Adrienne Boswell at Home
    Arbpen Web Site Design Services
    http://www.cavalcade-of-coding.info
    Please respond to the group so others can share
     
    Adrienne Boswell, Jul 25, 2009
    #2
    1. Advertising

  3. Brave

    Evertjan. Guest

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

    > Gazing into my crystal ball I observed Brave <>
    > writing in news:82d27840-c140-4af3-8e33-d334f867e339
    > @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.


    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)
     
    Evertjan., Jul 25, 2009
    #3
  4. Brave

    Brave Guest

    On Jul 25, 10:28 am, "Evertjan." <>
    wrote:
    > Adrienne Boswell wrote on 25 jul 2009 in
    > microsoft.public.inetserver.asp.general:
    >
    >
    >
    >
    >
    > > Gazing into my crystal ball I observed Brave <>
    > > writing in news:82d27840-c140-4af3-8e33-d334f867e339
    > > @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.

    >
    > 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.
     
    Brave, Jul 25, 2009
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Summu82
    Replies:
    5
    Views:
    868
    Richard Heathfield
    Jun 7, 2006
  2. Replies:
    2
    Views:
    882
    Hal Rosser
    Jun 1, 2007
  3. ssylee
    Replies:
    4
    Views:
    519
    Thad Smith
    Jan 1, 2008
  4. Chris Gunnels
    Replies:
    4
    Views:
    162
    Robert Klemme
    Sep 16, 2010
  5. middletree
    Replies:
    5
    Views:
    149
    middletree
    Jul 26, 2005
Loading...

Share This Page