Format Time . . . Not 12-/24-Hour Format

G

Guest

In a table, how do I format time so it does not appear in 12-/24-hour format?

For example, I want 39:00 ... but it shows up as 3:00 pm or 15:00. I tried
hh:mm but that defaults to short time (15:00). Any help would be
appreciated. Thanks!

deurbroucq
 
G

Guest

So, you don't really want Time, you want to hours and minutes. You could use
the DateDiff() function to compute the hours and minutes between two events,
if that is what you are looking for.
 
G

Guest

Hi, thanks for the reply! However, I'm adding up several times (the total
number of hours of overtime per week for a whole year).

Thanks!
deurbroucq
 
P

Paul Overway

You are trying to sum elapsed times. Each elapsed time needs to be
represented as a double, not a date/time. Convert each elapsed time to a
double like this:

[ElapsedTime]*24

This will give you the fractional hours, which can then be summed correctly.
 
J

John Vinson

In a table, how do I format time so it does not appear in 12-/24-hour format?

For example, I want 39:00 ... but it shows up as 3:00 pm or 15:00. I tried
hh:mm but that defaults to short time (15:00). Any help would be
appreciated. Thanks!

deurbroucq

Date/Time fields are not really appropriate for durations. They're
stored as Double Float numbers, a count of days and fractions of a day
since midnight, December 30, 1899. As such, 0.75 is 18:00 - actually
#12/30/1899 18:00:00# - but 1.5 is noon on New Years Eve, 1899!

Instead, store your duration in a Long Integer count of minutes. 39
hours would be stored as 2340. You can display it as hh:nn using an
expression like

[Duration] \ 60 & Format([Duration] MOD 60, ":00")

The \ is not a typo - it's an integer divide operator.

John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
G

Guest

Thanks, everyone, for making this such a reliable and valuable service. I
appreciate everyone's help.

deurbroucq!
 

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