Date.prototype Methods is submitted!
Your script is now in the approval queue. After a quick review we will notify you of the script's status by email. If everything's alright, we'll publish your work to the site and rss feed. Otherwise, we'll send you the email explaining what seems questionable. In that case, reply to the email whenever we should review the script again.
Also, don't hesitate to discuss things if you feel that our reasons are unfair. We are real folk, and we don't like bureaucracy. : )
Thank you for your contribution!
1
Date.prototype Methods
Edit script
Date instance methods for parsing, formatting, and calculating dates.
1. Parse various formats with ability to register custom formats. Ex:
Date.create('Sep 20 2006');
Date.create is aliased as $D.
2. Format dates using the well-known percent-letter formatting options. Ex:
$D('2006-09-20').strftime('%m/%d/%Y'); // "09/20/2006"
3. Add and subtract years, months, etc. Ex:
$D('09/20/2006').add(4, 'years').strftime('%Y-%m-%d'); // "2010-09-20"
4. Calculate differences between dates in the given unit. Ex:
$D('2006.09.28').diff('20 Sep, 2006', 'days'); // 8
- Website:
-
Date.prototype Methods
- Author:
-
Ken Snyder
- Size:
- 4.8 KB
- Last modified:
- 02/23/2008
- License:
-
MIT-style Prototype License
- Tags:
- date & time
- Rating:
-
1
(1/5 from 1 vote)
- Your rating:
-
0
Not yet rated
- Please sign in or register to rate this script
- You can't rate your own script.