1.0.6 • Published 4 years ago

date-filter v1.0.6

Weekly downloads
1
License
MIT
Repository
-
Last release
4 years ago

1.04版本后支持node

{{ 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:

paramexplanationexample
%aAbbreviated weekday.{{ timestamp | date "%a" }} => "Sat"
%AFull weekday name.{{ timestamp | date "%A" }} => "Tuesday"
%bAbbreviated month name.{{ timestamp | date "%b" }} => "Jan"
%BFull month name{{ timestamp | date "%B" }} => "January"
%cPreferred local date and time representation{{ timestamp | date "%c" }} => "Tue Apr 22 11:16:09 2014"
%dDay of the month, zero-padded (01, 02, 03, etc.).{{ timestamp | date "%d" }} => "04"
%-dDay of the month, not zero-padded (1,2,3, etc.).{{ timestamp | date "%-d" }} => "4"
%DFormats the date (dd/mm/yy).{{ timestamp | date "%D" }} => "04/22/14"
%eDay of the month, blank-padded ( 1, 2, 3, etc.).{{ timestamp | date "%e" }} => "3"
%FReturns the date in ISO 8601 format (yyyy-mm-dd).{{ timestamp | date "%F" }} => "2014-04-22"
%HHour of the day, 24-hour clock (00 - 23).{{ timestamp | date "%H" }} => "15"
%IHour of the day, 12-hour clock (1 - 12).{{ timestamp | date "%I" }} => "7"
%jDay of the year (001 - 366).{{ timestamp | date "%j" }} => "245"
%kHour of the day, 24-hour clock (1 - 24).{{ timestamp | date "%k" }} => "14"
%mMonth of the year (01 - 12).{{ timestamp | date "%m" }} => "04"
%MMinute of the hour (00 - 59).{{ timestamp | date "%M" }} => "53"
%pMeridian indicator (AM/PM).{{ timestamp | date "%p" }} => "PM"
%r12-hour time (%I:%M:%S %p){{ timestamp | date "%r" }} => "03:20:07 PM"
%R24-hour time (%H:%M){{ timestamp | date "%R" }} => "15:21"
%T24-hour time (%H:%M:%S){{ timestamp | date "%T" }} => "15:22:13"
%UThe number of the week in the current year, starting with the first Sunday as the first day of the first week.{{ timestamp | date "%U" }} => "16"
%WThe number of the week in the current year, starting with the first Monday as the first day of the first week.{{ timestamp | date "%W" }} => "16"
%wDay of the week (0 - 6, with Sunday being 0).{{ timestamp | date "%w" }} => "2"
%xPreferred representation for the date alone, no time. (mm/dd/yy).{{ timestamp | date "%x" }} => "04/22/14"
%XPreferred representation for the time. (hh:mm:ss).{{ timestamp | date "%X" }} => "13:17:24"
%yYear without a century (00.99).{{ timestamp | date "%y" }} => "14"
%YYear with a century.{{ timestamp | date "%Y" }} => "2014"
1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago