K
kamrhein
A number of closed topics deal with problems displaying military time
with various suggested solutions, but none of the discussions I have
seen mention that the the underlying problem seems to be a bug in
Access' Format Property.
I was unable to find a discussion of this problem in the Microsoft
Knowlege Base.
Military time (and many scheduling and dispatching applications) always
displays 24 hours with a leading zero for hours less than 10, e.g.,
"08/17/2006 05:35"
Contrary to its documentation, the Microsoft Access Format Property
does not display a leading zero for times with hours less than 10.
Reference: Microsoft Access Help Topic: "Format Property -
Date/Time Data Type".
"hh Hour in two[sic] digits (00 to 23)."
To demonstrate the issue:
1. Create a new blank database.
2. Create a new unbound form.
3. Add an unbound Text Box.
4. Set it's Format Property to "mm/dd/yyyy hh:nn".
5. Waste the next hour zorking around trying to get it to display
military time for hours less than 10. (OK, go ahead and bind it to a
Table Date/Time Field. Waste two hours. Fool with the Input Mask
Property. Waste three hours.)
This Format Property issue also applies to Reports, but can be kludged
by crafting a calculated Control with the Control Source set to an
expression calling the Format Function with the same format string
(=Format([MyDateTime], "mm/dd/yyyy hh:nn")), which works as
documented, but this technique is useless for Form data-entry Controls
that need to display military time.
with various suggested solutions, but none of the discussions I have
seen mention that the the underlying problem seems to be a bug in
Access' Format Property.
I was unable to find a discussion of this problem in the Microsoft
Knowlege Base.
Military time (and many scheduling and dispatching applications) always
displays 24 hours with a leading zero for hours less than 10, e.g.,
"08/17/2006 05:35"
Contrary to its documentation, the Microsoft Access Format Property
does not display a leading zero for times with hours less than 10.
Reference: Microsoft Access Help Topic: "Format Property -
Date/Time Data Type".
"hh Hour in two[sic] digits (00 to 23)."
To demonstrate the issue:
1. Create a new blank database.
2. Create a new unbound form.
3. Add an unbound Text Box.
4. Set it's Format Property to "mm/dd/yyyy hh:nn".
5. Waste the next hour zorking around trying to get it to display
military time for hours less than 10. (OK, go ahead and bind it to a
Table Date/Time Field. Waste two hours. Fool with the Input Mask
Property. Waste three hours.)
This Format Property issue also applies to Reports, but can be kludged
by crafting a calculated Control with the Control Source set to an
expression calling the Format Function with the same format string
(=Format([MyDateTime], "mm/dd/yyyy hh:nn")), which works as
documented, but this technique is useless for Form data-entry Controls
that need to display military time.