npm install date-filter1.04版本后支持node
``html`
{{ Date.now() | date '%T' }} => '13:34:36'
{{ 'Wed Jan 20 2016 13:34:36 GMT+0800' | date '%T' }} => '13:34:36'
{{ 1453268193752 | date '%Y-%m-%d' }} => '2016-01-20'
{{ new Date | date '%I:%M:%s %p' }} => '1:39:22 PM'
more date parameters are listed below:
| param | explanation | example |
|:--:|:--|:--|
|%a | Abbreviated weekday. |{{ timestamp | date "%a" }} => "Sat" |{{ timestamp | date "%A" }} => "Tuesday"
|%A |Full weekday name. ||{{ timestamp | date "%b" }} => "Jan"
|%b |Abbreviated month name. ||{{ timestamp | date "%B" }} => "January"
|%B |Full month name ||{{ timestamp | date "%c" }} => "Tue Apr 22 11:16:09 2014"
|%c |Preferred local date and time representation ||{{ timestamp | date "%d" }} => "04"
|%d |Day of the month, zero-padded (01, 02, 03, etc.). ||{{ timestamp | date "%-d" }} => "4"
%-d |Day of the month, not zero-padded (1,2,3, etc.). ||{{ timestamp | date "%D" }} => "04/22/14"
|%D |Formats the date (dd/mm/yy). ||{{ timestamp | date "%e" }} => "3"
|%e |Day of the month, blank-padded ( 1, 2, 3, etc.). ||{{ timestamp | date "%F" }} => "2014-04-22"
|%F |Returns the date in ISO 8601 format (yyyy-mm-dd). ||{{ timestamp | date "%H" }} => "15"
|%H |Hour of the day, 24-hour clock (00 - 23). ||{{ timestamp | date "%I" }} => "7"
|%I |Hour of the day, 12-hour clock (1 - 12). ||{{ timestamp | date "%j" }} => "245"
|%j |Day of the year (001 - 366). ||{{ timestamp | date "%k" }} => "14"
|%k |Hour of the day, 24-hour clock (1 - 24). ||{{ timestamp | date "%m" }} => "04"
|%m |Month of the year (01 - 12). ||{{ timestamp | date "%M" }} => "53"
|%M |Minute of the hour (00 - 59). ||{{ timestamp | date "%p" }} => "PM"
|%p |Meridian indicator (AM/PM). ||{{ timestamp | date "%r" }} => "03:20:07 PM"
|%r |12-hour time (%I:%M:%S %p) ||{{ timestamp | date "%R" }} => "15:21"
|%R |24-hour time (%H:%M) ||{{ timestamp | date "%T" }} => "15:22:13"
|%T |24-hour time (%H:%M:%S) ||{{ timestamp | date "%U" }} => "16"
|%U |The number of the week in the current year, starting with the first Sunday as the first day of the first week. ||{{ timestamp | date "%W" }} => "16"
|%W |The number of the week in the current year, starting with the first Monday as the first day of the first week. ||{{ timestamp | date "%w" }} => "2"
|%w |Day of the week (0 - 6, with Sunday being 0). ||{{ timestamp | date "%x" }} => "04/22/14"
|%x |Preferred representation for the date alone, no time. (mm/dd/yy). ||{{ timestamp | date "%X" }} => "13:17:24"
|%X |Preferred representation for the time. (hh:mm:ss). ||{{ timestamp | date "%y" }} => "14"
|%y |Year without a century (00.99). ||{{ timestamp | date "%Y" }} => "2014" `|
|%Y |Year with a century. |