24-hour clock format

  • Thread starter Thread starter PolQueen
  • Start date Start date
P

PolQueen

I have two issues. I need to show "military" (24-hour) time in my database,
and those fields are also used to calculate the amount of time used by
personnel.

I am using Access 2003 SP3, and cannot get it to hold the "0" if it is an
a.m. time (using date/time data type), i.e. 07:05 comes out as 7:05 or 07:05
AM. Storing data as text (not date/time) with mask "00:00;;_" works, but
time doesn't calculate properly.

This is what I am trying to do: Coverage Times: 07:30 - 09:05 = 1 hr. 35
min. OR
14:50 - 15:40 = 50 minutes. I use a field for start time, end time and an
expression in the query to calculate.

Thank you for your assistance!!!
 
Use the format of
hh:nn
to display military time to the minute.
hh:nn:ss
to display military time to the second.

Use the function at
http://www.accessmvp.com/djsteele/Diff2Dates.html
to display the difference in two times in hours and minutes.

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 
John said:
Use the format of
hh:nn
to display military time to the minute.
hh:nn:ss
to display military time to the second.

The format property will not display a leading zero on the hour unless
your Windows regional settings are configured to do so. Oddly you can
use format to supress the leading zero on hours when the regional
setting shows it by default, but you cannot use the format property to
display the leading zero if the regional setting is set to not show it.

The Format() function can show a leading zero regardless of the
regional setting though.
 
Use DateDiff("n",[start time], [end time]) to find difference in minutes.

Time_Span: DateDiff("n",[start time], [end time])\60 & "Hours : " &
DateDiff("n",[start time], [end time]) Mod 60 & " Minutes"
 
"military" (24-hour) time does not have AM or PM.
Use DateTime field, no mask, and in your input/output set
Format([YourDateTimeField], "hh:nn") for the 24 hour display.
 
Back
Top