Converting a 24hr format entry into 12hr format for display

H

hiaber

Ok. Here's the deal. I have a form that i input my data through - customer
name, arrival time, departure time etc. - times are entered as short time
24hr format. That data goes through a query that calculates my time on site,
and my travel time between sites via that 24 hr time data. this all then
goes to my report. That report is going to the boss, who doesn't want to see
24 hour military time.

Is there a way to convert the 24 hr time to display in the report as 12 hr
time - example 14:00 becomes 2:00??
 
D

Duane Hookom

Dates and Times are numbers. You use the Format property or Format()
function to change the display of the numbers.

Duane Hookom
MS Access MVP
 
V

vanderghast

Then, you will have to make a difference between 2:00 which is 14 hours
from the one which is 2 hours. Would you use AM/PM? Not a very great
'interval of time' unit, but bosses are like that, until they see the
result, they continue to ask for something that you know is illogical... and
when they will see the result, they will ask to come BACK to your logical
presentation.

Anyhow, as Duane mentioned it, it is only a matter of format:

? Format( now, "medium time")

uses the AM/PM thing, even if your regional setting is set for a 24h
preference, so:


? Format( numberOfHours / 24.0 , "medium time")


should do the job.


Note that you can use "short time" to force the 24h format (instead of the
"medium time").


Vanderghast, Access MVP
 

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