currentdate
Summary
Returns the timestamp of the current date/time.
Usage
currentdate()
Returns
The current date/time as a UNIX timestamp.
Description
This operator returns the UNIX timestamp for the current date/time.
Examples
Example 1
{def $timestamp=currentdate()}
Current timestamp: {$timestamp}Outputs the current timestamp.
Example 2
{def $timestamp=currentdate()}
Current date/time: {$timestamp|l10n( 'shortdatetime' )}Outputs the current date/time in a user friendly format.
Contributors
- Balazs Halasy Updated
- Gerald Commenter
- William Steenbergh Commenter
- Leif Arne Storset Commenter
Comments (3 historical)
Written by readers of the earlier documentation sites, kept as they were.
Possible improvements in this help
Gerald ·
Sometime is heplfull to have in the bottom of the explanation some links with functions related with the subject, in this case if there are other date formats.
Re: Possible improvements in this help
William Steenbergh ·
A common place to use the timestamp is in combination with the datetime() function. This can format an input date any way you want it:
{input|datetime( 'preset', ['arguments']}
Arguments is optional, and only used when the preset is not defined in your datetime.ini, but when using the setting 'custom'. The function description is in the documentation here ( http://ez.no/doc/ez_publish/techn...ng_and_internationalization/datetime ) and it contains a table with all formatting options. So this:
{let date=currentdate()|datetime(custom, '%l %d %F %Y')} Site was last updated on: {$date} {/let}is cheating :-)
See also
Leif Arne Storset ·
If you need the timestamp of the current date (not the time of day), you want to use makedate.