WithZDefault

Summary

The WithZDefault function converts date or date_time values to the Connect server cluster’s local time, the Pacific timezone.

Syntax

 WithZDefault(<date>|<date_time>|<offset_time>|<offset_date_time>|<zoned_date_time>|<instant>)

Return Type

Zoned_date_time

Details

Connect assumes any input parameter without timezone information is UTC.

Examples

select Now() as Now_is_UTC, WithZDefault(Now()) Converted_to_Pacific
from Empty();

screen-shot-2016-09-20-at-12-47-25-pm

 

Select ‘2014-01-01T20:15:23’ as base_date_time,
WithZDefault(‘2014-01-01T20:15:23’) as WithZDefault_Pacific
from Empty();

screen-shot-2016-09-20-at-12-47-31-pm

 

select ‘2014-12-03T10:15:30+01:00[Europe/Paris]’ as zoned_date_time_paris,
WithZDefault(‘2014-12-03T10:15:30+01:00[Europe/Paris]’) as WithZDefault_Pacfiic
from Empty();

screen-shot-2016-09-20-at-12-47-36-pm

select ‘1977-09-03T10:15:30+03:00’ as TRT_time_zone,
WithZDefault(‘1977-09-03T10:15:30+03:00’) as WithZDefault_Pacfiic
from Empty();

screen-shot-2016-09-20-at-12-47-42-pm

Related Functions

WithZOffset