Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / March 2005

Tip: Looking for answers? Try searching our database.

Leading zero in time

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Charles Tam - 23 Mar 2005 11:07 GMT
I would like to format a date/time field, such that, the time component is
displayed in 24 hours format. How do I ensure a leading zero is added to time
from 00:00 to 09:59?

For example, a leading zero is added to time 07:30.
Dennis - 23 Mar 2005 14:20 GMT
If component is a field in a table the set the Format property of the field
to General Date or Short Time and the zero is automatically added. If the
component is a field on a form then in t the afterUpdate event add the code
FieldName = Format(FieldName,"General Date") or Short Time or Medium Time or
whichever format you want

> I would like to format a date/time field, such that, the time component is
> displayed in 24 hours format. How do I ensure a leading zero is added to time
> from 00:00 to 09:59?
>
> For example, a leading zero is added to time 07:30.
Marshall Barton - 23 Mar 2005 17:41 GMT
>I would like to format a date/time field, such that, the time component is
>displayed in 24 hours format. How do I ensure a leading zero is added to time
>from 00:00 to 09:59?
>
>For example, a leading zero is added to time 07:30.

What have you tried?

Doesn't setting the text box's Format property to:
    mm/dd/yy hh:nn
do what you want?

Signature

Marsh
MVP [MS Access]

Charles Tam - 23 Mar 2005 19:19 GMT
In the text box format property, I set "d mmm yy, hh:nn", but the hour
leading zero still doesn't show up. For example, it shows "2 Oct 04, 1:00"
instead of "2 Oct 04, 01:00". Do you know how to fix it?

> >I would like to format a date/time field, such that, the time component is
> >displayed in 24 hours format. How do I ensure a leading zero is added to time
[quoted text clipped - 7 lines]
>     mm/dd/yy hh:nn
> do what you want?
Marshall Barton - 23 Mar 2005 20:27 GMT
Interesting!  I set a text box's Format property to:
    d mmm yyyy hh:nn
and it left out the 0 as you said.

I then tried using another text box with the expression:
    =Format(textbox1, "d mmm yyyy hh:nn")
and the 0 was included.

Exact same format string, but different results!??

If/how you can utilize that information, depends on your
specific situation.
Signature

Marsh
MVP [MS Access]

>In the text box format property, I set "d mmm yy, hh:nn", but the hour
>leading zero still doesn't show up. For example, it shows "2 Oct 04, 1:00"
[quoted text clipped - 11 lines]
>>     mm/dd/yy hh:nn
>> do what you want?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.