TinyMARE HelpText

Global Functions > Timefmt()

Timefmt()

timefmt(<format>, <time>)

Powers: Functions

Returns <time> as a formatted string as described in <format>. <time> is in the format of seconds, typically seconds since Unix Epoch. <format> contains one or more letters describing the format of the string to be returned. timefmt() is frequently used with xtime() to format the current date and time, but it can be used with anything that generates a value in seconds.

Format Characters

Character Returns Sample
W Day of the week (long) Saturday
D Day of the week (short) Sat
w Day of the week (numeric) 6
F Month (long) February
M Month (short) Feb
n Month (numeric) 2
m Month (numeric, 2 digit) 02
d Day of the month 18
e Day of the month (2 digit?) 18
S DoM suffex th
y Year (short) 17
Y Year (long) 2017
G Hour (12 hour) 5
H Hour (12 hour, 2 digit) 05
h Hour (24 hour) 17
g Hour (24 hour, 2 digit?) 17
i Minutes 39
s Seconds 32
p am/pm (lowercase) pm
P am/pm (uppercase) PM
j Day of the year 49
x Seconds since Epoch 1487458243
u ?? Large number 273668
I ?? DST flag?? 0
Example:
  [timefmt({W, F n, Y},xtime())]   => 'Saturday, February 2, 2017'

See also: xtime(), time(), tma(), tmf(), tml(), tms()

From the TinyMARE Help command - Courtesy Gandalf

-- SluggyQBFreak - 18 Feb 2017
Topic revision: r1 - 18 Feb 2017, SluggyQBFreak
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding WikiMARE? Send feedback