Use this function to convert date and time values from one geographic region into date and time values that are local to another geographic region. The function will also adjust for daylight savings time as needed.
TimeZone2TimeZone (PrefixName, TimeZone, NewTimeZone)
Parameter |
Description |
PrefixName |
Enter the prefix name associated with variables that will be used to hold date and time settings. Here are some examples: PrefixName.day |
TimeZone |
(Optional) Enter the time zone used for the PrefixName variables. If you enter an invalid time zone string, the system returns a value of zero (0) and sets variables associated with the PrefixName to zero (0). The default is to return the system’s current time zone setting. |
NewTimeZone |
(Optional). Enter the time zone by which you want to adjust the values in the PrefixName variables. If you enter an invalid time zone string, the system returns a value of zero (0) and sets variables associated with the PrefixName to zero (0). The default is to return the system’s current time zone setting. |
If you define these variables, the system uses the PrefixName and time you specified and converts that time to the equivalent time in the location you specified via the NewTimeZone parameter.
If you do not define these variables, the system creates these variables based on the PrefixName you entered and assigns values into these variables based on the current date and time.
If there are no errors, the system returns a non-zero value.
Here are some examples:
This example creates date and time variables using tz as a prefix (tz.day, tz.month, tz.year, tz.hour, tz.minute, tz.second) and stores the current date and time values based on the system's time zone:
TimeZone2TimeZone('tz', ,)
Print_It('Date:' & Date(, tz.day, tz.month, tz.year))
Print_It('Time:' & Time(, tz.hour, tz.minute, tz.second))
This example converts date and time variables (tz.xxxx) that use the system’s time zone into GMT date and time:
TimeZone2TimeZone('tz', , 'GMT')
Print_It('GMT Date:' & Date(, tz.day, tz.month, tz.year))
Print_It('GMT Time:' & Time(, tz.hour, tz.minute, tz.second))
This example converts a current America/New_York date and time into an Australia/Melbourne date and time:
tz.day = ''
tz.month = ''
tz.year = ''
tz.hour = ''
tz.minute = ''
tz.second = ''
if (TimeZone2TimeZone('tz', 'America/New_York', 'Australia/Melbourne')) then
Print_It('Australia/Melbourne Date:' & Date(, tz.day, tz.month, tz.year))
Print_It('Australia/Melbourne Time:' & Time(, tz.hour, tz.minute, tz.second))
else
Print_it('Error calling TimeZone2TimeZone')
end
© Copyright 2014, Oracle and/or its affiliates. All rights reserved. Legal notices.