Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I convert a Date/Time AM/PM value to Military Time

Status
Not open for further replies.

Pack10

Programmer
Feb 3, 2010
495
US
I need to track items "Time On" in my db. They come in with a "received_in" date/time (AM/PM) and the user completes the item with a Complete status and the system adds in Now() when completed. I need to show the time on, received_in to Completed...

I need to Calculate the "time on" ....so If a transaction is received in at 1/4/2012 at 3:34 PM, and is completed at 1/10/2012 10:39 AM It should not show as 5 days but 4 days because it was completed before 3:34 PM....

I have a function that does the calc but now I need military time or a way to convert.
 
Apparently you are calculating whole days but want to display some value as "military time".

Can you try again to explain what values you have and how you want to calculate and what you expect to display?

Duane
Hook'D on Access
MS Access MVP
 
All time is stored internally as a fraction of a day. So there is no conversion necessary, you just need to apply a format.

example: 1230 pm is .52083 (a little more than half a day). 6:00 pm would be .75.

Any date/time formatted as format(someTime,"HHMM") will show as military time.

So as Duane states it is your calculation that is the question.
 
I went into the debugger and noticed that the hourly values are indeed stored in military time.
 


BTW, the Format function, as referenced by MajP, returns a STRING representation of the Date/Time NUMERIC value.

You can configure a myriad of different FORMAT STRINGS or FORMAT DISPLAYS that represent a Date/Time NUMERIC value

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top