TZONEID Function

Returns the current time zone ID.

Category:Date and Time
Alias:TZID
Restrictions:This function is assigned an I18N Level 2 status, and is designed for use with SBCS, DBCS, and MBCS (UTF8). For more information, see Internationalization Compatibility.
This function is not valid in the CAS server.

Syntax

TZONEID<time-zone-id>

Optional Argument

time-zone-id

specifies a region or area value that is defined by SAS. When you specify a zone ID, the time zone that SAS uses is determined by the time zone name and daylight savings time rules.

Details

The TZONEID function returns a blank value if the TIMEZONE= option is blank or a user-defined time zone is specified.
The TZONEID function validates the timezone ID. If you specify the timezone ID, the function returns the timezone ID if it is valid or returns a blank value if the ID is invalid.

Example

In the first example, the TIMEZONE option is set to JST. In the second example, TIMEZONE is set to a blank value. In the third example TIMEZONE is set to user-specified time zone. In the fourth example a valid timezoneid and an invalid timezoneid is displayed.
Statements
Results
options timezone=jst;
data _null_ ;
	tzid=tzoneid() ;
	put tzid=;
run;
tzid=ASIA/TOKYO
options timezone='';
data _null_ ;
	tzid=tzoneid() ;
	put tzid=;
run;
tzid=
options timezone='xxx-12';
/* user defined timezone */
data _null_ ;
	tzid=tzoneid() ;
	put tzid=;
run;
tzid=
data null;
   name_valid=tzoneid('asia/tokyo');
   name_invalid=tzoneid('Milky Way');
   put name_valid =; 
   put name_invalid=;
run;
name_valid=ASIA/TOKYO
name_invalid=
Last updated: March 16, 2017