date'2008-01-31' date'2008-1-1' time'20:44:59' timestamp'2007-02-02 07:00:00.7569'
create table bikerace (name char(30), entry_number int, registration_date timestamp); insert into bikerace values ('Andersen, Mark', 342, timestamp'2007-03-15 12:27:33'); insert into bikerace values ('Steinbek, Mark', 244, timestamp'2006-11-27 13:26:19');
FedSQL Date/Time Data
Type
|
SAS Format
|
---|---|
DATE
|
DATE9.
|
TIME
|
TIME8.
|
TIMESTAMP
|
DATETIME19.2
|
create table basedt (d date, t time, ts timestamp); insert into basedt values (date '2013-03-14', time '10:31:22', timestamp '2013-03-14 13:30:33.222'); select * from basedt;
select put(ts,datetime21.2) from basedt;Here is the output:
Function
|
Description
|
---|---|
CURRENT_DATE
|
returns the current
date for your time zone.
|
CURRENT_TIME
|
returns the current
time for your timezone.
|
CURRENT_TIME_GMT()
|
returns the current
GMT time.
|
CURRENT_TIMESTAMP
|
returns the current
date and time for your timezone.
|
CURRENT_TIMESTAMP_GMT()
|
returns the current
GMT date and time.
|
DAY
|
returns the numeric
day of the month from a date or datetime value.
|
HOUR
|
returns the hour from
a time or datetime value.
|
MINUTE
|
returns the minute from
a time or datetime value.
|
MONTH
|
returns the numeric
month from a date or datetime value.
|
SECOND
|
returns the second from
a time or datetime value.
|
YEAR
|
returns the year from
a date or datetime value.
|
Type
|
Language Element
|
Input
|
Formatted Result
|
---|---|---|---|
Date formats
|
DATE.
|
date'2013-03-17'
|
17MAR13
|
|
DATE9.
|
date'2013-03-17'
|
17MAR2013
|
|
DATEAMPM21.
|
timestamp'2013-03-17
14:22:21'
|
17MAR13:02:22:21 PM
|
|
DATEAMPM23.
|
timestamp'2013-03-17
14:22:21'
|
17MAR2013:02:22:21 PM
|
|
DAY.
|
date'2013-03-17'
|
17
|
|
DDMMYY.
|
date'2013-03-17'
|
17/03/13
|
|
DDMMYB.
|
date'2013-03-17'
|
17 03 13
|
|
DDMMYYC.
|
date'2013-03-17'
|
17:03:13
|
|
DDMMYYD10.
|
date'2013-03-17'
|
17-03-2013
|
|
DDMMYYN.
|
date'2013-03-17'
|
17032013
|
|
DDMMYYP.
|
date'2013-03-17'
|
17.03.13
|
|
DDMMYYS.
|
date'2013-03-17'
|
17/03/13
|
|
DOWNAME.
|
date'2013-03-17'
|
Monday
|
|
JULIAN.
|
date'2013-03-17'
|
13077
|
|
MMDDYY.
|
date'2013-03-17'
|
03/17/13
|
|
MMDDYY10.
|
date'2013-03-17'
|
03/17/2013
|
|
MMDDYYB.
|
date'2013-03-17'
|
03 17 13
|
|
MMDDYC.
|
date'2013-03-17'
|
03:17:13
|
|
MMDDYD.
|
date'2013-03-17'
|
03-17-13
|
|
MMDDYN.
|
date'2013-03-17'
|
03172013
|
|
MMDDYYP.
|
date'2013-03-17'
|
03.17.13
|
|
MMDDYYS.
|
date'2013-03-17'
|
03/17/13
|
|
MMYY.
|
date'2013-03-17'
|
03M2013
|
|
MMYYC.
|
date'2013-03-17'
|
03:2013
|
|
MMYYD.
|
date'2013-03-17'
|
03-2013
|
|
MMYYN.
|
date'2013-03-17'
|
032013
|
|
MMYYP.
|
date'2013-03-17'
|
03.2013
|
|
MMYYS.
|
date'2013-03-17'
|
03/2013
|
|
MONNAME.
|
date'2013-03-17'
|
March
|
|
MONTH.
|
date'2013-03-17'
|
3
|
|
MONYY.
|
date'2013-03-17'
|
MAR13
|
|
WEEKDATE.
|
date'2013-03-17'
|
Monday, March 17, 2013
|
|
WEEKDATX.
|
date'2013-03-17'
|
Monday 17 March 2013
|
|
WEEKDAY.
|
date'2013-03-17'
|
2
|
Datetime formats
|
DTDATE.
|
timestamp'2013-03-18
14:22:21'
|
17MAR13
|
|
DTMONYY.
|
timestamp'2013-03-18
14:22:21'
|
MAR13
|
|
DTWKDATX.
|
timestamp'2013-03-18
14:22:21'
|
Monday, March 17 2013
|
|
DTYEAR.
|
timestamp'2013-03-18
14:22:21'
|
2013
|
|
DTYYQC.
|
13:1
|
|
Quarter formats
|
QTR.
|
date'2013-03-17'
|
1
|
|
QTRR.
|
date'2013-03-17'
|
I
|
Time formats
|
HHMM.
|
time'14:22:21'
|
14:22
|
|
HOUR.
|
time'14:22:21'
|
14
|
|
TIME.
|
time'14:22:21'
|
14:22:21
|
|
TIMEAMPM.
|
time'14:22:21'
|
2:22:21 PM
|
|
TOD.
|
time'14:22:21
|
14:22:21
|
Year formats
|
YEAR.
|
date'2013-03-17'
|
2013
|
|
YYMM.
|
date'2013-03-17'
|
2013M03
|
|
YYMMC.
|
date'2013-03-17'
|
2013:03
|
|
YYMMD.
|
date'2013-03-17'
|
2013-03
|
|
YYMMN.
|
date'2013-03-17'
|
201303
|
|
YYMMP.
|
date'2013-03-17'
|
2013.03
|
|
YYMMS.
|
date'2013-03-17'
|
2013/03
|
|
YYMMDD.
|
date'2013-03-17'
|
13-03-17
|
|
YYMMDDB.
|
date'2013-03-17'
|
13 03 17
|
|
YYMMDDC.
|
date'2013-03-17'
|
13:03:17
|
|
YYMMDDD.
|
date'2013-03-17'
|
13-03-17
|
|
YYMMDDN.
|
date'2013-03-17'
|
20130317
|
|
YYMMDDP.
|
date'2013-03-17'
|
13.03.17
|
|
YYMMDDS.
|
date'2013-03-17'
|
13/03/17
|
|
YYMON.
|
date'2013-03-17'
|
2013MAR
|
Year/Quarter formats
|
YYQ.
|
date'2013-03-17'
|
2013Q1
|
|
YYQC.
|
date'2013-03-17'
|
2013:1
|
|
YYQD.
|
date'2013-03-17'
|
2013-1
|
|
YYQN.
|
date'2013-03-17'
|
20131
|
|
YYQP.
|
date'2013-03-17'
|
2013.1
|
|
YYQS.
|
date'2013-03-17'
|
2013/1
|
|
YYQR.
|
date'2013-03-17'
|
2013QI
|
|
YYQRC.
|
date'2013-03-17'
|
2013:I
|
|
YYQRD.
|
date'2013-03-17'
|
2013-I
|
|
YYQRN.
|
date'2013-03-17'
|
2013I
|
|
YYQRP.
|
date'2013-03-17'
|
2013.I
|
|
YYQRS.
|
date'2013-03-17'
|
2013/I
|