Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tomkp/dates.js
Simple javascript date parser / formatter
https://github.com/tomkp/dates.js
Last synced: about 1 month 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 (over 14 years ago)
- Default Branch: master
- Last Pushed: 2014-09-15T04:07:29.000Z (about 10 years ago)
- Last Synced: 2024-04-09T11:22:55.248Z (7 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```