ascii-time(3)ascii-time - Return the current time as a string
ascii-time [ "format" ]
ascii-time returns the current time as a formatted string in #p9 which is equivalent to #l9 for the calling macro. The format of the resultant string is determined by the variable the parameter format, if given, otherwise by the variable %ascii-time. The format is defined using the following escape characters:
%% - % char
%a - Replaced by abbreviated week day name (3 letters)
%A - Replaced by full week day name
%b - Replaced by abbreviated month name (3 letters)
%B - Replaced by full month name
%d - Replaced by two digit day of month (01 to 31)
%e - As with %d except a leading 0 is replaced by a space ( 1 to 31)
%H - Replaced by two digit hour of the day (00 to 23)
%i - Replaced by day of month (1 to 31)
%k - Replaced by hour of the day (0 to 23)
%J - Replaced by day of year (0 to 365)
%j - Replaced by three digit day of year (000 to 365)
%M - Replaced by two digit minute of the hour (00 to 59)
%m - Replaced by two digit month (01 to 12)
%N - Replaced by minute of the hour (0 to 59)
%o - Replaced by month number (1 to 12)
%S - Replaced by two digit second of the minute (00 to 59)
%v - Replaced by second of the minute (0 to 59)
%w - Replaced by day of the week (0 to 6 Sunday=0)
%y - Replaced by the last two digits of the year (00 to 99)
%Y - Replaced by the year as a decimal number (e.g. 2024)
%* - All other characters are printed literally.
The default value of %ascii-time when not defined is:
"%Y-%m-%d %H:%M:%S"
To change the default date layout then %ascii-time should be defined in user.emf. i.e.
set-variable %ascii-time "%a %b %d %H:%M:%S %Y"
The following is taken from etfinsrt.emf, it uses ascii-time in replacing "$ASCII_TIME$" with the current.
0 define-macro insert-template . . ; Change the create date $ASCII_TIME$. beginning-of-buffer ; Get ASCII time in #l9 ascii-time !force replace-string "\\$ASCII_TIME\\$" #l9 . . !emacro
ascii-time is a macro defined in utils.emf.
The default format was changed in 2025 to be ISO 8601 compliant. Some of the escape characters, such as %#d, were also changed to be more compliant with $mode-line(5) and C's strftime(3) function.
The current date and time can be easily inserted into the current buffer by using the main Edit menu's Insert Date/Time feature.
(c) Copyright JASSPA 2025
Last Modified: 2025/03/26
Generated On: 2025/09/29