NLTIME Function

Converts the SAS time or the datetime value to the time value of the specified locale by using the NLTIME descriptors.
Category: Date and Time

Syntax

NLTIME(time|datetime,descriptor,startpos)

Required Arguments

time
specifies a SAS time value.
datetime
specifies a SAS datetime value.
descriptor
is a variable, or expression, that specifies the value of a descriptor. You can enter the following descriptors in uppercase or lowercase:
#
removes the leading zero from the result.
%%
specifies the % character.
%H
specifies the hour descriptor that is based on a 24-hour clock. The range for the hour descriptor is 00–23.
%I
specifies the hour descriptor that is based on a 12-hour clock. The range for the hour descriptor is 01–12.
%M
specifies the minute modifier. The range for the minute descriptor is 00–59.
%P
specifies the a.m. or p.m. descriptor.
%S
specifies the second descriptor. The range for the second descriptor is 00–59.
startpos
is an integer that specifies the position at which the search should start and that specifies the direction of the search.

Details

The NLTIME function converts a SAS time or datetime value to the time value of the specified locale by using the time descriptors.

Example

The following example shows an a.m. or p.m. time that is created from a SAS time.
Statements
Results
----+----1----+
options locale=English;
time_ampm=nltime('12:39:43't,'%i%p');
put time_ampm;
00 PM
options locale=German;
time_ampm=nltime('12:39:43't,'%i%p');
put time_ampm;
00 nachm

See Also

Format: