double digit hour question

DKY

Registered User.
Local time
Today, 05:38
Joined
Mar 18, 2005
Messages
17
I set my format for my date/time to hh for the double digit hours and it displays 7 instead of 07. What am I missing here?
 
DKY,

That's the internal representation. You can use the FORMAT function to
display what you want.

Wayne
 
If this is your situation...

Just because you set the time format for the field in your table to HH you also have to set the format for that field to HH in the form as well.
 
WayneRyan said:
DKY,

That's the internal representation. You can use the FORMAT function to
display what you want.

Wayne

I'm not sure what you mean by 'internal representation' I want it to put a leading zero in the hour when its less than 10, just like it does with the minutes and the seconds. Since it does it for them, I dont understand why it doesnt do it for the hour. Not sure how to use the FORMAT function. I thought I was using that. Is it the area below in access where you set the format to hh:nn:ss AM/PM? If so, I get something like this. 7:02:03 AM instead of 07:02:03 AM eventhough I insert exactly that 07:02:03 AM. I'm lost partially due to my noobness with Access :D
 
Not sure why either for the preceeding zero works for the Date but not for the Time.

This works...

mm/dd/yyyy

but this does not...

hh:nn:ss

And neither does this for the time...

mm/dd/yyyy hh:nn:ss
 
so, you tried it on your microsoft access and it doesnt work for you either?
 
DKY said:
so, you tried it on your microsoft access and it doesnt work for you either?
Correct. The examples I gave above were tested in Access 2003 and I could not get the preceeding zero to display for the time. I could for the date but not the time.
 
same here. Does anyone know of a way around this?
 
You could probably use an unbound text box to display the time by converting it to a string and then formatting the way you want it. But, it would only display and not be able to update (unless you had a bunch of coding going along with it).
 
DKY,

Interesting.

Short-term workaround. Indented for readability.

Code:
IIf(DatePart("h", Test) > 9, 
             Format(Test, "dd/mm/yy hh:mm:ss"), 
             Format(Test, "dd/mm/yy h:mm:ss"))

Wayne
 

Users who are viewing this thread

Back
Top Bottom