Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Date Intervals, Formats, and Functions

SAS Date, Time, and Datetime Functions

DATE()
returns today's date as a SAS date value.

DATEJUL( yyddd )
returns the Julian date for a SAS date value.

DATEPART( datetime )
returns the date part of a SAS datetime value as a date value.

DATETIME()
returns the current date and time of day.

DAY( date )
returns the day of the month from a SAS date value.

DHMS( date, hour, minute, second )
returns a SAS datetime value for date, hour, minute, and second values.

HMS( hour, minute, second )
returns a SAS time value for hour, minute, and second values.

HOUR( datetime )
returns the hour from a SAS datetime or time value.

INTCK( interval, date1, date2 )
returns the number of boundaries of intervals of the given kind that lie between the two date or datetime values.

INTNX( interval, date, n <, 'alignment' > )
returns the date or datetime value of the beginning of the interval that is n intervals from the interval that contains the given date or datetime value. The optional alignment argument specifies that the returned date is aligned to either the beginning, middle, or end of the interval. Beginning is the default.

JULDATE( date )
returns the Julian date from a SAS date value.

MDY( month, day, year )
returns a SAS date value for month, day, and year values.

MINUTE( datetime )
returns the minute from a SAS time or datetime value.

MONTH( date )
returns the month of the year from a SAS date value.

QTR( date )
returns the quarter of the year from a SAS date value.

SECOND( date )
returns the second from a SAS time or datetime value.

TIME()
returns the current time of day.

TIMEPART( datetime )
returns the time part of a SAS datetime value.

TODAY()
returns the current date as a SAS date value. (TODAY is another name for the DATE function.)

WEEKDAY( date )
returns the day of the week from a SAS date value.

YEAR( date )
returns the year from a SAS date value.

YYQ( year, quarter )
returns a SAS date value for year and quarter values.

Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Top
Top

Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.