How do I create a formula to add hours to a mm/dd/yy h:mm format c

  • Thread starter Thread starter bm05
  • Start date Start date
B

bm05

I wish to create a tide predictor. I have the stated date/time for High and
Low tide. I wiould like to create a formula to add/subtract hours based on
different locations in the region.

Ft. Mchenry - High Tide 7/01/2008 01:20
new location Sandy Pt. is Ft Mchenry High Tide plus 2 hours (should equal
7/01/2008 03:20)
 
Just add 0.0416666666 to the value of Ft. Mchenry

formated as number:
39672,0000000000
39672,0416666666

formated as date/time
12.08.2008 00:00
12.08.2008 01:00
 
Sub test()
Dim dt1 As Date, dt2 As Date
dt1 = DateSerial(2008, 7, 1) + TimeSerial(1, 20, 0) 'y,m,d + h,m,s

dt2 = dt1 + TimeSerial(2, 0, 0)

MsgBox Format(dt1, "mmm/d/yy h:m") & vbCr & _
Format(dt2, "mmm/d/yy h:m")

End Sub
 

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

Back
Top