TimeToTimeZone function
Syntax
TimeToTimeZone(OldTime, SourceTimeZone, DestinationTimeZone)
Description
Use the TimeToTimeZone function to convert a time field from the time specified by SourceTimeZone to the time specified by DestinationTimeZone.
Parameters
| Parameter | Description |
|---|---|
|
OldTime |
Specify the time value to be converted. |
|
SourceTimeZone |
Specify the time zone that OldTime is in. Values are: timezone - a time zone abbreviation or a field reference to be used for converting OldTime. Local - use the local time zone for converting OldTime. Base - use the base time zone for converting OldTime. |
|
DestinationTimeZone |
Specify the time zone that you want to convert OldTime to. Values are: timezone - a time zone abbreviation or a field reference to be used for converting OldTime. Local - use the local time zone for converting OldTime. Base - use the base time zone for converting OldTime. |
Returns
A converted time value.
Example
The following example TESTTM is a time field with a value 01/01/99 10:00:00. This example converts TESTTM from Eastern Standard Time (EST) to Pacific Standard Time (PST).
&NEWTIME = TimeToTimeZone(TESTTM, "EST", "PST");
&NEWTIME is a time variable with a value of 7:00:00AM.
Considerations Using this Function
This function should generally be used in PeopleCode, not for displaying time. If you take a time value, convert it from base time to client time, then try to display this time, depending on the user settings, when the time is displayed the system might try to do a second conversion on an already converted time. This function could be used as follows: suppose a user wanted to check to make sure a time was in a range of times on a certain day, in a certain timezone. If the times were between 12 AM and 12PM in EST, these resolve to 9 PM and 9AM PST, respectively. The start value is after the end value, which makes it difficult to make a comparison. This function could be used to do the conversion for the comparison, in temporary fields, and not displayed at all.