Results 1 to 2 of 2

Thread: rest 2 hours to the system hour

  1. #1
    Join Date
    Dec 2006
    Location
    Basque Country
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default rest 2 hours to the system hour

    I have got this code:
    formatHour=FormatDateTime(Now,4)
    hour=Mid(formatoHour,1,2) & Mid(formatoHour,4,1) & "0"

    formatHour has got (for example) 10:15
    then hour has got 1000

    i want to rest 2 hours to the system hour, but i donot know.
    I would want that formatHour have 8:15

    Thankyou

    Be careful with this:
    If the system hour is 0:00 the desired hour should be: 22:00

  2. #2
    Join Date
    Feb 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    the easiest way is to merely use dateadd thusly:

    NewTime=dateadd("h",-2,formatHour)

    NewTime will now contain the time in formathour minus two hours. It will work for any valid time of the day

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •