xf:get-timezone-from-time

Extracts the current timezone from $time-var.

If $time-var does not contain a timezone, the empty sequence is returned.

If the value of $time-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.

Signatures

xf:get-timezone-from-time(xs:time? $time-var) —> xs:string?

Arguments

Data Type
Argument
Description

xs:time?

$time-var

Contains a representation of the date and time.

Returns

Returns the current timezone as a string from $time-var.

Returns an empty sequence, if $time-var does not contain a timezone. (See examples below.)

Examples

Timezone

The following example uses the get-timezone-from-time function with a timezone:

<tz>{xf:get-timezone-from-time(xs:time("14: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 timezone which is 5 hours behind Coordinated Universal Time (UTC).

UTC Timezone

The following example uses the get-timezone-from-time function with a timezone:

<tz>{get-timezone-from-time(xs:time("14:21:01Z"))}</tz> 

The preceding query generates the following result:

<tz>00:00</tz> 

In this preceding query, the Z means the time is being specified in Coordinated Universal Time (UTC), so no timezone is reported.

No Timezone

The following is an example of using the get-timezone-from-time function with no timezone specified:

<tz>{xf:get-timezone-from-time(xs:time("22:21:01"))}</tz> 

Returns an empty sequence, because $time-var does not contain a timezone.

Related Topics

W3C get-timezone-from-time function description.

W3C time data type description.