ftime()

Function usage:

ftime([format [, time]])


Returns a string formatted from an absolute system time time (obtained from time() or mktime()) according to format. If time is omitted, it defaults to the current time. If time is out of range, ftime() returns an empty string and prints an error message. If format is omitted, it defaults to %time_format. If format is "@", a raw system time (e.g., seconds since 1970-01-01 00:00:00 UTC) will be displayed. Otherwise, each "%" in format describes a conversion:

%@
raw system time, in seconds, to the nearest microsecond (nonstandard)
%.
microseconds since last whole second (nonstandard)
%a
abbreviated weekday name
%A
full weekday name
%b
abbreviated month name
%B
full month name
%c
local time and date representation
%d
day of month (01-31)
%F
ISO 8601 date format (equivalent to "%Y-%m-%d")
%H
hour on 24-hour clock (00-23)
%I
hour on 12-hour clock (01-12)
%j
day of year (001-366)
%m
month (01-12)
%M
minute (00-59)
%p
local equivalent of "AM" or "PM"
%s
raw system time, rounded down to the nearest whole second (nonstandard)
%S
second (00-61)
%T
ISO 8601 time format (equivalent to "%H:%M:%S")
%U
week number of year, Sunday is first day of week (00-53)
%w
weekeday (0-6, Sunday is 0)
%W
week number of year, Monday is first day of week (00-53)
%x
local date representation
%X
local time representation
%y
year without century (00-99)
%Y
year with century
%Z
time zone name, if any
%%
"%"
Names and conversions labeled "local" may be affected by the setting of the LC_TIME locale category. Additional "%" conversions may be supported by your system, including 3-character conversions starting with "%E" and "%O"; see your system's strftime() documentation for details. All other characters in format are copied unmodified to the result.

The formats "%@" and "%s.%." do not give the same results if time is negative.

Example:
command: /expr ftime("Today is %a %b %d", time())
output: Today is Thu Jul 02

See: functions, time(), locale, %TZ, %time_format, %clock_format.


Back to index
Back to tf home page
Copyright © 1998, 1999, 2002, 2003, 2004, 2005, 2006-2007 Ken Keys