https://github.com/borgar/date.format
Provides PHP style date formatting for JavaScript as outlined in the PHP docs: http://php.net/date
https://github.com/borgar/date.format
Last synced: about 2 months ago
JSON representation
Provides PHP style date formatting for JavaScript as outlined in the PHP docs: http://php.net/date
- Host: GitHub
- URL: https://github.com/borgar/date.format
- Owner: borgar
- License: mit
- Created: 2010-03-08T00:02:39.000Z (about 16 years ago)
- Default Branch: master
- Last Pushed: 2010-09-20T16:11:25.000Z (over 15 years ago)
- Last Synced: 2025-03-22T06:45:47.841Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 86.9 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: MIT-LICENSE.txt
Awesome Lists containing this project
README
Date.format
===========
Provides a nearly full implementation of PHP style date formatting for JavaScript as outlined in the
PHP documentation: http://php.net/date. Missing is all timezone related functionality. This may get
added at a later date, but currently only outputs defaults for UTC zone.
The function comes attached to Date, and you may use it like that:
var dt = new Date( 1975, 9, 16, 10, 45, 0 );
Date.format( dt, 'l jS \of F Y h:i:s A' );
If you want to move the function to date prototype where, arguably, it may be more useful:
Date.prototype.format = function () {
return Date.format( this, arguments );
};
That will allow you to do this:
new Date( 2010, 4, 12, 12, 13, 0 ).format( 'c' );
Additionally, the function support a noConflict method which allows you to unassign it from
Date and into whatever name or variable you want.
$.dateFormat = Date.format.noConflict();