Cole100
asked on
Converting UST columns to PST timezone
I need to convert this UTC timestamp to PST:
5/29/2008 2:06:00 PM
so it reads:
5/29/2008 6:06:00 AM
Assuming this requires an expression, Im not sure how to code this.
thanks.
5/29/2008 2:06:00 PM
so it reads:
5/29/2008 6:06:00 AM
Assuming this requires an expression, Im not sure how to code this.
thanks.
wouldnt it be -4 as you are taking away ?
DateAdd("h",-4,Me.MyDateFi eld)
DateAdd("h",-4,Me.MyDateFi
ASKER
thanks
I need this to convert the whole columns data.....not just a single field. My report is generated from a linked db and updates daily. I want to build an expression that 1. displays DATE()-1 and 2. converts the same UST columns to PST. Pardon my confusion.
I need this to convert the whole columns data.....not just a single field. My report is generated from a linked db and updates daily. I want to build an expression that 1. displays DATE()-1 and 2. converts the same UST columns to PST. Pardon my confusion.
ASKER
UST - 8hrs = PST, I thought?
Here is a generic solution.
Call it like this:
datUTC = #5/29/2008 2:06:00 PM#
lngBiasUTC = 0
lngBiasPST = 60 * 8
datPST = DateAddTimeZoneDiff(datUTC , lngBiasUTC, lngBiasPST)
/gustav
Call it like this:
datUTC = #5/29/2008 2:06:00 PM#
lngBiasUTC = 0
lngBiasPST = 60 * 8
datPST = DateAddTimeZoneDiff(datUTC
/gustav
Public Function DateAddTimeZoneDiff( _
ByVal datLocal As Date, _
ByVal lngLocalBias, _
ByVal lngRemoteBias) _
As Date
' Calculates the date/time of datLocal in a remote time zone.
' Adds the difference in minutes between the local time zone bias and
' the remote time zone bias, if both bias are relative to UTC.
'
' Examples:
'
' datRemote = DateAddTimeZoneDiff(Now(), 60, -600)
' will return datRemote as eleven hours ahead of local time.
'
' datRemote = DateAddTimeZoneDiff(Now(), -600, 60)
' will return datRemote as eleven hours behind local time.
'
' 2000-05-30. Cactus Data ApS, CPH.
' 2005-01-25. Adjusted to accommodate change in TimeZoneBiasDiff().
Dim datRemote As Date
Dim lngBias As Long
' Get difference (in minutes) in time zone bias.
lngBias = TimeZoneBiasDiff(lngLocalBias, lngRemoteBias)
' Calculate remote date/time.
datRemote = DateAdd("n", lngBias, datLocal)
DateAddTimeZoneDiff = datRemote
End Function
Public Function TimeZoneBiasDiff( _
ByVal lngLocalTimeBias As Long, _
ByVal lngRemoteTimeBias As Long) _
As Long
' Calculates the difference in minutes between two time zones,
' typically from the local time zone to the remote time zone.
' Both time zones must be expressed by their bias relative to
' UTC (Coordinated Universal Time) which is measured in minutes.
'
' 2000-05-30. Cactus Data ApS, CPH.
' 2005-01-25. Output reversed to express bias value.
' Minimum amount of minutes for a time zone bias.
Const clngTimeZoneBiasMin As Long = 15
Dim lngTimeZoneBiasDiff As Long
' Round off time zone bias by minimum time zone difference.
lngLocalTimeBias = lngLocalTimeBias \ clngTimeZoneBiasMin
lngLocalTimeBias = lngLocalTimeBias * clngTimeZoneBiasMin
lngRemoteTimeBias = lngRemoteTimeBias \ clngTimeZoneBiasMin
lngRemoteTimeBias = lngRemoteTimeBias * clngTimeZoneBiasMin
' Calculate difference in time zone bias.
lngTimeZoneBiasDiff = lngLocalTimeBias - lngRemoteTimeBias
TimeZoneBiasDiff = lngTimeZoneBiasDiff
End Function
ASKER
I dont want to put in a specific datetime..........I need all the fields under the timestamp column to be converted to PST.
ASKER
specifically: I need all fields to convert for cloockin datetime and clockout datetime.
Clock_In_Datetime Clock_Out_Datetime EOD Clockout Flag
Last name First name 10/17/2008 5:00:00 PM 10/17/2008 9:43:00 PM 0
Last name First name 10/17/2008 10:25:00 PM 10/18/2008 1:11:00 AM -1
Clock_In_Datetime Clock_Out_Datetime EOD Clockout Flag
Last name First name 10/17/2008 5:00:00 PM 10/17/2008 9:43:00 PM 0
Last name First name 10/17/2008 10:25:00 PM 10/18/2008 1:11:00 AM -1
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
DateAdd("h",4,Me.MyDateFie
this is for adding 4 hours to your field value.
jppinto