Documentation

Light-weight, fast, simple and powerful!
 
Translations of this page?:

date()

To display the date a page was created, use:

<?php echo $this->date(); ?>

If you want to change the format of the date, you can pass it as the first parameter of the method like this:

<?php echo $this->date('%A, %e %B %Y'); ?>

For more information about the date format, check the PHP manual for strftime.

On Windows, and rarely in other settings, the use of %e may prevent any date appearing! In this case, use %d in its place. (See PHP Bugs for more information, the date howto for a work-around.)

Values

The default date returned is the page’s creation date. The dates which can be displayed are:

  • created — (default) which returns the date the page was initially stored in the database, no matter what “Status” it had;
  • published — which returns the date the page was first saved with the “Status” set to “Published”; and
  • updated — which returns the most recent date on which that page was altered (this can include re-ordering)

Example

For example, if you want to display the last updated time of this page, use this:

<?php echo $this->date('%a, %e %b %Y', 'updated'); ?>

How to translate every date in your layout

Set the locale to your language with the setlocale PHP function:

<?php setlocale(LC_ALL, 'fr_CA.utf8'); ?>

For more information about this function, consult the PHP manual on setlocale.

 
functions/date.txt · Last modified: 2011-09-12 00:46 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license:GNU Free Documentation License 1.2
Copyright 2010 wolfcms.org / design by yello studio / Wolf CMS Inside