|
|
|
|
| Advertise on this site |
Very often in our programmes we need to work with dates and time. Sometimes this operation is rather complicated and we writing a lots of code to do it well.
Instead of this we can use DateJs open-source JavaScript Date Library.
Here is the short example how you can use it
// 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, mintue: 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′);
You can download DateJS library here
These do work.
Here is the
Amazing ,how can he do that!
I like this post. It help me
pretty! I wish you can keep
Thanks for sharing the post!
I can use it in
That's very nice plugin! I
These tips help me a lot!
Thanks for sharing the post!
Very good plugin! I like it!
Comments