24 hour time format

rfcomm2k

New member
Local time
Today, 01:35
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;"
 
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:
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'
 
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
 
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

Back
Top Bottom