Format the time structure tm_struct in a flexible way using the format
string fmt that contains ‘%’ substitutions similar to those in
printf.
Except where noted, substituted fields have a fixed size; numeric fields are padded if necessary. Padding is with zeros by default; for fields that display a single number, padding can be changed or inhibited by following the ‘%’ with one of the modifiers described below. Unknown field specifiers are copied as normal characters. All other characters are copied to the output without change. For example:
strftime ("%r (%Z) %A %e %B %Y", localtime (time ()))
     ⇒ "01:15:06 AM (CST) Monday 17 February 1997"
Octave’s strftime function supports a superset of the ANSI C field
specifiers.
Literal character fields:
%%% character.
%nNewline character.
%tTab character.
Numeric modifiers (a nonstandard extension):
- (dash)Do not pad the field.
_ (underscore)Pad the field with spaces.
Time fields:
%HHour (00-23).
%IHour (01-12).
%kHour (0-23).
%lHour (1-12).
%MMinute (00-59).
%pLocale’s AM or PM.
%rTime, 12-hour (hh:mm:ss [AP]M).
%RTime, 24-hour (hh:mm).
%sTime in seconds since 00:00:00, Jan 1, 1970 (a nonstandard extension).
%SSecond (00-61).
%TTime, 24-hour (hh:mm:ss).
%XLocale’s time representation (%H:%M:%S).
%zOffset from UTC (±hhmm), or nothing if no time zone is determinable.
%ZTime zone (EDT), or nothing if no time zone is determinable.
Date fields:
%aLocale’s abbreviated weekday name (Sun-Sat).
%ALocale’s full weekday name, variable length (Sunday-Saturday).
%bLocale’s abbreviated month name (Jan-Dec).
%BLocale’s full month name, variable length (January-December).
%cLocale’s date and time (Sat Nov 04 12:02:33 EST 1989).
%CCentury (00-99).
%dDay of month (01-31).
%eDay of month ( 1-31).
%DDate (mm/dd/yy).
%hSame as %b.
%jDay of year (001-366).
%mMonth (01-12).
%UWeek number of year with Sunday as first day of week (00-53).
%wDay of week (0-6).
%WWeek number of year with Monday as first day of week (00-53).
%xLocale’s date representation (mm/dd/yy).
%yLast two digits of year (00-99).
%YYear (1970-).
See also: strptime, localtime, gmtime, mktime, time, now, date, clock, datenum, datestr, datevec, calendar, weekday.
Package: octave