24 hour time format (1 Viewer)

rfcomm2k

New member
Local time
Today, 17:10
Joined
Mar 25, 2009
Messages
8
How do I make the output of the following code appear as 24 hour time?

stSQL = "UPDATE [" & CiscoTableName & "] SET [" & CiscoTableName & "].dateTimeConnect1 = dateserial(1970,1,1) + [" & CiscoTableName & "]![dateTimeConnect]/86400-4/24;"
 

MSAccessRookie

AWF VIP
Local time
Today, 17:10
Joined
May 2, 2008
Messages
3,428
How do I make the output of the following code appear as 24 hour time?

stSQL = "UPDATE [" & CiscoTableName & "] SET [" & CiscoTableName & "].dateTimeConnect1 = dateserial(1970,1,1) + [" & CiscoTableName & "]![dateTimeConnect]/86400-4/24;"


The Format() Command is what you will need to insert in the appropriate place to display the Military Time.

Ex: Format(Now(), "hh:nn") returns 16:15 and Format(Now(), "hhnn") returns 1615
 
Last edited:

rfcomm2k

New member
Local time
Today, 17:10
Joined
Mar 25, 2009
Messages
8
OK, that seems logical, but where would the appropriate place be to put that code? I tried this:

stSQL = "UPDATE [" & CiscoTableName & "] SET [" & CiscoTableName & "].dateTimeConnect1 = dateserial(1970,1,1) + [" & CiscoTableName & "]![dateTimeConnect]/86400-4/24 format([" & CiscoTableName & "]![dateTimeConnect], hh:nn);"

This gave me an error 'expected end of line'
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 22:10
Joined
Sep 12, 2006
Messages
15,658
i am confused about how the time is stored
if it is stored in a vba data time variable

then try
format (mytime, "short time")
format (mytime, "medium time")
format (mytime, "long time")

see if one of those gets what you want

--------
if not, then try using dateserial and other functions to assign it to a normal datetime variable, then carry on with standard time formatting commands
 

rfcomm2k

New member
Local time
Today, 17:10
Joined
Mar 25, 2009
Messages
8
Solved it like this:

stSQL = "UPDATE [" & CiscoTableName & "] SET [" & CiscoTableName & "].dateTimeConnect1 = format(dateserial(1970,1,1) + [" & CiscoTableName & "]![dateTimeConnect]/86400-4/24,'mm/dd/yy Hh:Nn:Ss');"
 

Users who are viewing this thread

Top Bottom