# xf:get-timezone-from-date

Extracts the current timezone from $date-var.

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

If the value of $date-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-date(xs:date? $date-var) —> xs:string?

### Arguments

Data Type | Argument | Description
--- | --- | ---
xs:date? | $date-var | Contains a representation of the date.

### Returns

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

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

### TExamples

#### Timezone

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

    <tz>{xf:get-timezone-from-date(xs:date("2002-08-30-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-date function with a timezone:

    <tz>{xf:get-timezone-from-date(xs:date("2002-08-30Z"))}</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-date function with no timezone specified:

    <tz>{xf:get-timezone-from-date(xs:date("2002-08-30"))}</tz>

The preceding query generates the following result:

    <tz/>

Related Topics

W3C get-timezone-from-date function description.

W3C date data type description.