Chapter 19 Date and Size Functions

Table of Contents
19.1 Display current date: date
19.2 Display file date: fdate
19.3 Displaying Last Modify Dates
19.4 File Size

Cows allows to automatically compute and insert into your pages:

  1. the date of last modify relative to the page you're creating;

  2. the date of last modify relative to a given file;

  3. the size of a given file.

These features will spare you some boring operation and reduce chances of an error. Maintaining your site will also be easier, since every time you run Cows on a given file, these informations will be automatically updated.

19.1 Display current date: date

Synopsis

date(format_string);

Description

This function returns a string representing the current date according to the format described by format_string; 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"                         };

Example

echo (date ("Updated: #d #M #y"));

displays current date according to the following format:

Updated: 19 October 2003

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