{"id":34596152,"url":"https://github.com/the-eater/date.format","last_synced_at":"2026-05-23T23:31:01.711Z","repository":{"id":12098748,"uuid":"14687368","full_name":"the-eater/date.format","owner":"the-eater","description":"MySQL like date formatting in JavaScript","archived":false,"fork":false,"pushed_at":"2014-03-10T09:29:29.000Z","size":152,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-18T22:29:56.100Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/the-eater.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-11-25T14:14:51.000Z","updated_at":"2014-03-10T09:29:29.000Z","dependencies_parsed_at":"2022-09-15T21:50:32.660Z","dependency_job_id":null,"html_url":"https://github.com/the-eater/date.format","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/the-eater/date.format","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/the-eater%2Fdate.format","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/the-eater%2Fdate.format/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/the-eater%2Fdate.format/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/the-eater%2Fdate.format/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/the-eater","download_url":"https://codeload.github.com/the-eater/date.format/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/the-eater%2Fdate.format/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33416313,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-23T22:14:44.296Z","status":"ssl_error","status_checked_at":"2026-05-23T22:14:43.778Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-12-24T11:43:35.339Z","updated_at":"2026-05-23T23:31:01.705Z","avatar_url":"https://github.com/the-eater.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"date.format\n===========\n\nMySQL like date formatting in JavaScript  \n\n\n\nHow does it work?\n==\n\nSimple! just include [this script](https://raw.github.com/EaterOfCode/date.format/master/date.format.js) in your page with a script tag\n```html\n    \u003cscript src='js/date.format.js'\u003e\u003c/script\u003e\n```\nand then go wild with JavaScript\n```html\n\u003cscript\u003e\n    console.log((new Date()).format('Welcome to the year %Y! Humans are now 20%% robots,'\n                                    +'but today on %W %e %m we will change that!'));\n\u003c/script\u003e\n```\ndate.format.js understands all MySQL formats except `%D`\n\n\nTable of available specifiers\n==\n\nSpecifier|Description\n--------|----\n`%a`|Abbreviated weekday name (Sun..Sat)\n`%b`|Abbreviated month name (Jan..Dec)\n`%c`|Month, numeric (0..12)\n`%d`|Day of the month, numeric (00..31)\n`%e`|Day of the month, numeric (0..31)\n`%f`|Microseconds (000000..999999)\n`%H`|Hour (00..23)\n`%h`|Hour (01..12)\n`%I`|Hour (01..12)\n`%i`|Minutes, numeric (00..59)\n`%j`|Day of year (001..366)\n`%k`|Hour (0..23)\n`%l`|Hour (1..12)\n`%M`|Month name (January..December)\n`%m`|Month, numeric (00..12)\n`%p`|AM or PM\n`%r`|Time, 12-hour (`%h:%i:%s %p`)\n`%S`|Seconds (00..59)\n`%s`|Seconds (00..59)\n`%T`|Time, 24-hour (`%H:%i:%s`)\n`%U`|Week (00..53), where Sunday is the first day of the week\n`%u`|Week (00..53), where Monday is the first day of the week\n`%V`|Week (01..53), where Sunday is the first day of the week; used with %X\n`%v`|Week (01..53), where Monday is the first day of the week; used with %x\n`%W`|Weekday name (Sunday..Saturday)\n`%w`|day of the week (0=Sunday..6=Saturday)\n`%X`|Year for the week where Sunday is the first day of the week, numeric, four digits; used with %V\n`%x`|Year for the week, where Monday is the first day of the week, numeric, four digits; used with %v\n`%Y`|Year, numeric, four digits\n`%y`|Year, numeric (two digits)\n`%%`|A literal “%” character\n\n(This table is straight from [MySQL Manual](http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_date-format))\n\nAPI\n==\n\ndate.format.js exposes the following objects\n\n`dateFormatter`  \n+ `days` -\u003e zero indexed array with names for the week days  \n+ `months` -\u003e zero indexed array with names for the months  \n+ `getWeek(date,day)` -\u003e gets the week number of the given date, day represents the first day of the week (0=sunday, ... 6=saturday) monday is default  \n+ `suffixer(str,len)` -\u003e puts zeroes before the given string untill the lenght is eqaul to len  \n+ `format(date,str)` -\u003e formats the given date with the given string  \n  \n`(new Date()).format`-\u003e formats the date with the given string\n\nTranslation\n==\n\ntranslating is simple, for example here is how date.format.js can be translated to dutch\n```html\n\u003cscript src='js/date.format.js'\u003e\u003c/script\u003e\n\u003cscript\u003e\n    dateFormatter.months = [\n      \"Januari\",\n      \"Februari\",\n      \"Maart\",\n      \"April\",\n      \"Mei\",\n      \"Juni\",\n      \"Juli\",\n      \"Augustus\",\n      \"September\",\n      \"Oktober\",\n      \"November\",\n      \"December\"\n    ];\n    dateFormatter.days = [\n      \"Zondag\", // start this array with sunday!\n      \"Maandag\",\n      \"Dinsdag\",\n      \"Woensdag\",\n      \"Donderdag\",\n      \"Vrijdag\",\n      \"Zaterdag\"\n    ];\n    // will produce 'Dinsdag 20 Februari 1996'\n    console.log((new Date('1996-02-20')).format('%W %e %m %Y'));\n\u003cscript\u003e\n```        \nCredits\n==\n\n[dblock](https://github.com/dblock/) for his [getWeek](https://gist.github.com/dblock/1081513) script\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthe-eater%2Fdate.format","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthe-eater%2Fdate.format","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthe-eater%2Fdate.format/lists"}