Datejs is an open-source JavaScript Date Library. Comprehensive, yet simple, stealthy and fast. Datejs has passed all trials and is ready to strike. Datejs doesn’t just parse strings, it slices them cleanly in two.
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
<script> // What date is next thrusday? Date.today().next().thursday(); // Add 3 days to Today Date.today().add(3).days(); // Is today Friday? Date.today().is().friday(); // Number fun (3).days().ago(); // 6 months from now var n = 6; n.months().fromNow(); // Set to 8:30 AM on the 15th day of the month Date.today().set({ day: 15, hour: 8, minute: 30 }); // Convert text into Date Date.parse('today'); Date.parse('t + 5 d'); // today + 5 days Date.parse('next thursday'); Date.parse('February 20th 1973'); Date.parse('Thu, 1 July 2004 22:30:00'); </script> |