- Parse Dates with these parsers
- The "Date" column is using the sugar library to parse dates. Make sure to include the sugar library and the sugar-date-parser.
- The "Weekday" column uses the included "weekday" parser. You can modify parser to match whatever language you are using.
- The "Month" column uses the included "month" parser. You can also modify the month names within the parser to match whatever language you are using.
- The "Year" column is just using the included two digit year parser:
- Formats for "mmddyy", "ddmmyy" and "yymmdd" are available
- Within the parser code is a
rangevariable which is set to
50years range, which sets the date be within +/- range of the listed two digit year.
- So if the current year is
2020, and the listed two digit year is
2080 - 2020 > 50), it becomes
- If the listed two digit year is
2050 - 2020 < 50), then it becomes
2050. I hope that makes it clearer.
- Try out the two digit year calculator below the table.
- In v2.14.0, the range can be set using the
dateRangeoption (see the initialization code below).
- The "Time" column is using the built-in time parser which has been always been included with tablesorter .
|next friday||Friday||Aug||1/1/12||12:00 PM|
|the day after tomorrow||Wed||July||1/1/13||13:00|
|May 25th of next year||Tues||Nov||1/1/11||14:00|
|25 May 2010||Tuesday||November||1/1/11||1:58 PM|
|the last day of March||Mon||December||1/1/12||2:10 PM|
|one day before yesterday||Thursday||Feb||1/1/08||4:00 AM|
Two digit year calculator:
two digit year becomes 2020
<!-- blue theme stylesheet with additional css styles added in v2.0.17 --> <link rel="stylesheet" href="../css/theme.blue.css"> <!-- tablesorter plugin --> <script src="../js/jquery.tablesorter.js"></script> <!-- load month, weekday and two digit year parsers --> <script src="../js/parsers/parser-date-month.js"></script> <script src="../js/parsers/parser-date-weekday.js"></script> <script src="../js/parsers/parser-date-two-digit-year.js"></script> <!-- http://sugarjs.com/dates#comparing_dates --> <script src="../js/sugar.js"></script> <script src="../js/parsers/parser-date-sugar.js"></script>
Next up: Applying the filter widget ››