Hi,
I'm using this code to place the time in a cell:
timestamp = Format(Now(), "hh:mm:ss")
As a result i get: 4:32:51 PM
But what i want is 16:32:51
Who can help me?
Hi,
I'm using this code to place the time in a cell:
timestamp = Format(Now(), "hh:mm:ss")
As a result i get: 4:32:51 PM
But what i want is 16:32:51
Who can help me?
I have had mixed results using the Format function. I have had "some" success using capital H's and M's when I wanted 24 hour formats, for example
Format(Now(),"HH:MM")
but often the results default to whatever you have set for your system, i.e., 12 hr w/AMPM or 24 hr. I have my computer set to 24 hour time, so I get 24 hour output with either hh:mm or HH:MM (most of the time). When I set my system to 12 hr time, HH:MM sometimes works. I have had mixed results with getting a 4 digit year out of the format function too. When I use Format(datevalue,"dd-mmm-yyyy") and should get, for today, 21-Feb-2005, I often get 21-Feb-05.
The FormatDateTime has specific formats that work more reliably:
FormatDateTime(Now(),vbShortTime) has given consistent 24 hour time out even when I set my computer to 12 hour time.
Hope this helps
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks