STRFTIME()

From Recital Documentation Wiki
Jump to: navigation, search

Purpose

Return a character string including a formatted date or datetime string


Syntax

STRFTIME(<expC1> [, <expC2> ])


See Also

AMPM(), CDOW(), CMONTH(), CTOD(), CTOT(), DATE(), DATETIME(), DAY(), DAYS(), DOW(), DTOC(), DTOM(), DTOS(), DTOV(), ELAPTIME(), EMPTY(), EPOCH(), GOMONTH(), HOUR(), HOURS(), LTOS(), MDY(), MINUTE(), MINUTES(), MONTH(), MTOD(), MTOS(), QUARTER(), SEC(), SECONDS(), SECS(), SET CENTURY, SET DATE, SET EPOCH, SET HOURS, SET MARK, SET SECONDS, SET VAXTIME, STOD(), STR(), TIME(), TIMESTAMP(), TSTRING(), TTOC(), TTOD(), TYPE(), VAL(), VALIDTIME(), VTOD(), WEEK(), YEAR()


Description

The STRFTIME() function returns a character string including a date or datetime string formatted according to <expC1>. The <expC1> string may include any of the format elements from the table below. The optional <expC2> is a date or datetime in string format. If <expC2> is not specified, the current system date and time are assumed.


Format Element Description Example value
Day
%a Abbreviated character day of the week Sun - Sat
%A Character day of the week Sunday - Saturday
%d Day of the month (two digits with leading zero) 01 to 31
%e Day of the month (space precedes single digits) 1 - 31
%j Day of the year (three digits with leading zeros) 001 - 366
%u ISO-8601 numeric day of the week 1 (Monday) - 7 (Sunday)
%w Numeric day of the week 0 (Sunday) - 6 (Saturday)
Week
%U Week of the year: week 01 starts from the first Sunday 00 - 53
%V ISO-8601 week of the year: week 01 is the first week with at least 4 weekdays, Monday start 01 to 53
%W Week of the year: week 01 starts from the first Monday 00 - 53
Month
%b Abbreviated month Jan - Dec
%B Month January - December
%h Abbreviated month Jan - Dec
%m Month (two digits with leading zero) 01 to 12
Year
%C Century 19 (1900 - 1999) - 20 (2000 - 2037)
%g ISO-8601 two digit year: week 01 is the first week with at least 4 weekdays, Monday start 00 - 99
%G ISO-8601 four digit year: week 01 is the first week with at least 4 weekdays, Monday start 1902 - 2037
%y Two digit year 00 - 99
%Y Four digit year 1902 - 2037
Time
%H Two digit hour in 24 hour format 00 - 23
%I Two digit hour in 12 hour format 01 - 12
%l Two digit hour in 12 hour format (space precedes single digits) 1 - 12
%M Two digit minutes 00 - 59
%p Upper-case AM or PM AM or PM
%P Lower-case AM or PM am or pm
%r Equivalent of "%I:%M:%S %p" e.g. 01:26:04 PM
%R Equivalent of "%H:%M" e.g. 13:26
%S Two digit seconds 00 - 59
%T Equivalent of "%H:%M:S%" e.g. 13:26:04
%X Time based on locale preference e.g. 01:26:04 or 13:26:04
%z Time-zone e.g. GMT or +0000
%Z Time-zone alternative format e.g. +0000 or GMT
Time and Date Stamps
%c Date and time based on locale preference e.g. Mon Nov 30 01:26:04 2009
%D Equivalent of "%m/%d/%y" e.g. 11/30/09
%F Equivalent of "%Y-%m-%d" e.g. 2009-11-30
%s UNIX Epoch Time timestamp e.g. 1259587564 for 11/30/2009 01:26:04 PM
%x Date based on locale preference e.g. 11/30/09
Miscellaneous
%n New line character
%t Tab character
%% % character


Example

echo strftime("%c",ttoc(datetime()))
echo strftime("%U",dtoc(date()))


Products

Recital, Recital Server