Convert Time

T

tina

if you're storing the data in a Date/Time field, then it's only stored one
way, regardless of the format for viewing. just change the Format property
of the field, or of the control in the view you're looking at.

hth
 
S

Stefan Hoffmann

hi,

Secret said:
How can I convert military time to standard time?
You only have to add the correct time zone offset as Zulu time is the
same as GMT/UTC.



mfG
--> stefan <--
 
J

John W. Vinson

How can I convert military time to standard time?

How is the data stored now? As a Date/Time field, as a string, as a number?
Could you give an example?
 
S

Secret Squirrel

Hi Tina,

Thanks for the input. I'm appending this data from another table that is
stored in military time. It's stored in that format because that's the format
I'm importing from an excel spreadsheet. In the table that I'm appending it
to I changed the format to medium time. I assume that it will just change the
format when I do the append, correct?

SS
 
T

tina

is the other table an Access table? what is the DataType of the field in the
other table. again, in Access, date/time data type values are stored only
one way - as a Double number, with the "left side" of the decimal point
being the number of days from Jan 1, 100 (IIRC), and the "right side" of the
decimal point being a fraction of a day. so "civilian time" vs "military
time" is a matter of formatting only, it has nothing to do with how the time
is stored.

if the data is stored in the other table as a Text data type, then you can
use the CDate() function in the Append query, where CDate("15:24") is
correctly converted to 3:24:00 PM. once the data is stored as a Date/Time
data type, you can set the field's Format property to ShortTime to get a
military format, and Medium time to get a "civilian" format.

hth
 
S

Secret Squirrel

The data is set as military time in an excel spreadsheet that is linked to my
DB. What I do is append this file to another table in access. In this table I
have the format set to "Medium Time" and (99:00\ >LL;0;).

So when I run the append it does change it to "Medium Time". I just wanted
to be sure that when I run the append that it shows the (99:00\ >LL;0;)
instead of military time. It seems to work ok.
 
J

John W. Vinson

The data is set as military time in an excel spreadsheet that is linked to my
DB. What I do is append this file to another table in access. In this table I
have the format set to "Medium Time" and (99:00\ >LL;0;).

So when I run the append it does change it to "Medium Time". I just wanted
to be sure that when I run the append that it shows the (99:00\ >LL;0;)
instead of military time. It seems to work ok.

Yep. Don't confuse data presentation (affected by Formats and Input Masks)
with data storage. Dates and times are stored as numbers, irrespective of the
format specified.
 
D

Douglas J. Steele

<picky>
The integer portion of the date field represents the date as the number of
days relative to 30 Dec, 1899

Otherwise, you're absolutely correct.
</picky>
 
T

tina

no, not picky - wrong is wrong. and i have to admit, i wondered about that
date because it didn't seem like the date i've seen cited in the ngs in past
posts, Doug. but i looked through Help to try to find the specific "date
counted from", and the only date i found was the one i cited. can you direct
me to where i can check the next time, because i'm sure to forget the right
(and wrong!) date again - but i might remember where to look, if i'm lucky!
(isn't it carrots that are supposed to improve memory? wait, i can't
recall...) tia, tina :)
 
D

Douglas J. Steele

The Access 97 Help file (which I still use constantly states "Negative whole
numbers represent dates before 30 December 1899."

If you're not sure, though, you can always go into the Immediate Panel and
check what Format(0, "yyyy\-mm\-dd") returns
 
T

tina

Douglas J. Steele said:
The Access 97 Help file (which I still use constantly states "Negative whole
numbers represent dates before 30 December 1899."

ah, there was my problem, then - i was looking in A2003 Help.
If you're not sure, though, you can always go into the Immediate Panel and
check what Format(0, "yyyy\-mm\-dd") returns

oh, of course, duh - why didn't i think of that, thanks! :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top