19.2 Display file date: fdate

Synopsis

fdate(file_name, format_string);

Description

This function returns a string representing the date of last modify relative to file_name according to the format described by format_string.

Both file_name and format_string can be any valid expression:

It simply returns format_string interpreting the following sequences:

#y

current year (1972 ...)

#m

month (1..12)

#d

day of month ( 1..31)

#M

full month name (January..December)

#D

full weekday name (Sunday..Saturday)

#h (added in G-Cows 1.6)

hour

#n (added in G-Cows 1.6)

minutes

#s (added in G-Cows 1.6)

seconds

Full month names and full weekday names are stored in arrays _months [ ] and _days [ ]; you can simply override these variables in order to change the names. As an example, if your site is written in Italian, you can place this definition in a file and include it everywhere you need:

_months [ ] = { "Gennaio",  "Febbraio",  "Marzo",   "Aprile",    "Maggio",
                "Giugno",   "Luglio",    "Agosto",  "Settembre",
                "Ottobre",  "Novembre",  "Dicembre"                       };
_days [ ]   = { "Domenica", "Lunedi",    "Martedi", "Mercoledi",
                "Giovedi",  "Venerdi",   "Sabato"                         };

Important: if you use Cows-mkgen to create makefiles, file_name can only be provided as a string constant (e.g. "foo.ps") or via the inputfile () and outputfile () functions; otherwise, Cows-mkgen will miss the dependency and raise a warning. Of course, Cows will correctly display file date, since it can handle complex expressions, but if the file is changed, make won't update output file. For further informations see Section 24.1.

Example

Assuming manual.ps was updated on the first day of December 2002,

echo (fdate ("manual.ps", "(#D, #d #M #y)"));

will display:

(Friday, 1 December 2002)

This manual can be downloaded from http://www.g-cows.org/.