Site Tools


strftime

# $EPIC: strftime.txt,v 1.5 2006/08/29 18:22:56 sthalik Exp $

Synopsis:

$strftime(<format>)
$strftime(<time_t> <format>)

Technical:

  • If the <format> argument is omitted the empty string is returned.
  • If the <format> argument is invalid the empty string is returned.
  • The first argument is optional. If provided it must be the number of seconds since the epoch (e.g. $time()). If a time is not provided, the current $time() is used.
  • The rest of the argument(s) are taken as a strftime(3) format string and are passed directly to strftime(3).
  • The return value of the function is the specified time converted into the human readable form described by your strftime(3) format.
  • Avoid using system-specific strftime(3) formats for portability reasons.

Practical:

You should refer to your system's strftime man page (``man strftime'') for exact details of what a strftime format looks like, because describing them is beyond the scope of a help file. =) But this function is very useful for creating timestamps that look just like how you want them.

Returns:

A description of the specified <time_t> using the format string <format>, as processed by strftime(3).

Examples:

$strftime(%d %B %Y)  might return "13 December 1996"
$strftime(%x at %X)  might return "12/13/96 at 16:45:42"
$strftime(%m/%d/%y)  might return "07/16/01"
$strftime(%Y/%m/%d)  might return "2001/07/16"

History:

This function first appeared in ircII-2.8.1, and was first included in EPIC3pre8.

strftime.txt · Last modified: 2006/08/29 20:18 by 127.0.0.1