Extracts the current timezone from $dateTime-var and returns it as a string.
If $dateTime-var does not contain a timezone, the empty sequence is returned.
If the value of $dateTime-var is the empty sequence, the empty sequence is returned. The empty sequence is a sequence containing zero items (), which is similar to null in SQL.
xf:get-timezone-from-dateTime(xs:dateTime? $dateTime-var) —> xs:string?
Returns the current timezone as a string from $dateTime-var.
Returns an empty sequence, if $dateTime-var does not contain a timezone. (See examples below.)
The following example uses the get-timezone-from-dateTime function with a timezone:
<tz>{xf:get-timezone-from-dateTime("2002-08-30T14:21:01-05:00")}</tz>
The preceding query generates the following result:
<tz>-05:00</tz>
In the preceding query, the -05:00 string specifies the time is specified in the Eastern Standard time zone which is 5 hours behind Universal Time, Coordinated (UTC).
The following example uses the get-timezone-from-dateTime function with a timezone:
<tz>{xf:get-timezone-from-dateTime("2002-08-30T14:21:01Z")}</tz>
The preceding query generates the following result:
<tz>00:00</tz>
In this example, the Z means the time is being specified in Universal Coordinated, Time (UTC), so no timezone is reported.
The following is an example of using the get-timezone-from-dateTime function with no timezone specified:
<tz>{xf:get-timezone-from-dateTime("2002-08-30T22:21:01")}</tz>
The preceding query generates the following result:
<tz/>
W3C get-timezone-from-dateTime function description.
W3C dateTime data type description.