Format / DateViewHelper¶
ViewHelper to format a date, using strftime
Type: Basic
General properties¶
Name: | Type: | Description: | Default value: |
---|---|---|---|
currentDate | bool | if true, the current date is used | |
date | mixed | DateTime object or a string that is accepted by DateTime constructor | |
format | string | Format String which is taken to format the Date/Time | %Y-%m-%d |
strftime | bool | if true, the strftime is used instead of date() | 1 |
Examples¶
Basic example using default strftime¶
Code:
<n:format.date>{newsItem.dateTime}</n:format.date>
Output:
2013-06-08
Basic example using default strftime and a format¶
Code:
<n:format.date format="%B">{newsItem.dateTime}</n:format.date>
Output:
June
Basic example using datetime¶
Code:
<n:format.date format="c" strftime="0">{newsItem.crdate}</n:format.date>
Output:
2004-02-12T15:19:21+00:00
Render current time¶
Code:
<n:format.date format="c" strftime="0" currentDate="1">{newsItem.crdate}</n:format.date>
Output:
2013-06-12T15:19:21+00:00