working with time zones in access

F

Frustrated

I have times in access which I need to see in different time zones , I need
to be able to see a product where its local time is GMT but also see it's
time PST , etc .I created a table and have a column formated as date/time, I
also have another field which is the hour difference ie +7 etc, in the query
I take the time field (GMT) and add the hour field (time difference) if the
time goes past 12 midnight I get the time but including a mad date also , any
way around this
ex:[gmt]+[hour] 16:00 + 8:00 . come out fine if doesn't goes past 12midnight
 
S

Stephen Knapp

(Sorry about that, "finger check"). As I was trying to say, use the
DATEVALUE and TIMEVALUE functions to get the MS internal number for the
starting date and time. Use TIMEVALUE against the GMT hour difference and
add the converted starting date/time to the converted GMT delta. Use the
MONTH, DAY, YEAR, HOUR, and MINUTE functions to reconstitute the new
date/time. I'd stick these computations in a query. Depending on my
subsequent use, I might build fields in the starting table for these
calculations.

Steve in Ohio
 
T

Tim Ferguson

I take the time field (GMT) and add the hour field (time difference)
if the time goes past 12 midnight I get the time but including a mad
date also , any way around this
ex:[gmt]+[hour] 16:00 + 8:00 . come out fine if doesn't goes past
12midnight

Public Sub Timezone()
Dim dtSomeTime As Date

dtSomeTime = CDate("2004-12-10 19:00")
dtSomeTime = dtSomeTime + (8# / 24)
Debug.Print Format(dtSomeTime, "\#yyyy\-mm\-dd hh:nn\#")

End Sub

produces

#2004-12-11 03:00#

which to me looks exactly right. What do you expect?

Tim F
 

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