Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

24-hour clock format

2 views
Skip to first unread message

PolQueen

unread,
Nov 10, 2009, 2:31:01 PM11/10/09
to
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!!!

John Spencer

unread,
Nov 10, 2009, 3:19:14 PM11/10/09
to
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

Rick Brandt

unread,
Nov 10, 2009, 7:32:04 PM11/10/09
to
John Spencer wrote:

> 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.

KARL DEWEY

unread,
Nov 10, 2009, 10:27:05 PM11/10/09
to
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"

--
Build a little, test a little.

KARL DEWEY

unread,
Nov 10, 2009, 10:27:07 PM11/10/09
to
"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.

--
Build a little, test a little.

0 new messages