https://github.com/tomkp/dates.js
Simple javascript date parser / formatter
https://github.com/tomkp/dates.js
Last synced: 4 months ago
JSON representation
Simple javascript date parser / formatter
- Host: GitHub
- URL: https://github.com/tomkp/dates.js
- Owner: tomkp
- Created: 2010-04-18T19:01:04.000Z (about 15 years ago)
- Default Branch: master
- Last Pushed: 2014-09-15T04:07:29.000Z (almost 11 years ago)
- Last Synced: 2025-01-24T17:17:51.250Z (6 months ago)
- Language: JavaScript
- Homepage: http://tomkp.github.com/dates.js
- Size: 750 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Dates.js - parsing & formatting dates using regexs
Simple javascript date parser / formatter.
Minifies to < 3k.
[Mocha tests](https://github.com/tomkp/dates.js/blob/master/test/dates_tests.js)
## Examples
### Parsing a date
```Dates.parse("12/03/2009 18:02", "dd/MM/yyyy HH:mm");```
### Formatting a date
```Dates.format(new Date(2010, 3, 14, 18, 02, 39, 123), "yyyy-MM-ddTHH:mm:ss.SSS");```
### Formatting
```y```: Year eg: ```1996```, ```96```
```M```: Month in year eg: ```July```, ```Jul```, ```07```
```d```: Day in month eg: ```10```
```E```: Day in week eg: ```Tuesday```, ```Tue```
```H```: Hour in day (0-23) eg: ```9```
```m```: Minute in hour eg: ```30```
```s```: Second in minute eg: ```55```
```S```: Millisecond eg: ```978```