Excel vs VBA Dates

E

ExcelMonkey

In excel I can create hourly dates over a 24 hour period that rang
from:

1/1/2002 0:00

to

1/1/2002 23:00

Thus it uses military time. By using the format m/d/yyyy h:mm an
adding 1/24 each hour.

But when I try this in VBA I get:

1/1/2004 0:00
1/1/2004 1:00:00 AM
1/1/2004 2:00:00 AM
1/1/2004 3:00:00 AM
1/1/2004 4:00:00 AM
1/1/2004 5:00:00 AM
1/1/2004 6:00:00 AM
1/1/2004 7:00:00 AM
1/1/2004 8:00:00 AM
1/1/2004 9:00:00 AM
1/1/2004 10:00:00 AM
1/1/2004 11:00:00 AM
1/1/2004 12:00:00 PM
1/1/2004 1:00:00 PM
1/1/2004 2:00:00 PM
1/1/2004 3:00:00 PM
1/1/2004 4:00:00 PM
1/1/2004 5:00:00 PM
1/1/2004 6:00:00 PM
1/1/2004 7:00:00 PM
1/1/2004 8:00:00 PM
1/1/2004 9:00:00 PM
1/1/2004 10:00:00 PM
1/1/2004 11:00:00 PM

Is there any way in VBA to express m/d/yyyy h:mm in military time?

Thank
 
E

ExcelMonkey

Apparently when I use:

Debug.Print Format(CurrentHourlyDate, "m/d/yyyy h:mm")

it seems to work
 

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

Top