{"id":18508372,"url":"https://github.com/eknkc/dateformat","last_synced_at":"2025-07-22T17:03:41.386Z","repository":{"id":5187059,"uuid":"6361798","full_name":"eknkc/dateformat","owner":"eknkc","description":"DateFormat provides convenient date formatting with localization support. Built in support for French, German, Spanish, Dutch, Turkish and English","archived":false,"fork":false,"pushed_at":"2012-10-24T01:09:20.000Z","size":104,"stargazers_count":9,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-22T00:02:32.412Z","etag":null,"topics":["dateformat","go","language","time"],"latest_commit_sha":null,"homepage":"http://go.pkgdoc.org/github.com/eknkc/dateformat","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"doctrine/doctrine2","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eknkc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-10-23T23:33:25.000Z","updated_at":"2023-04-06T04:15:30.000Z","dependencies_parsed_at":"2022-09-08T00:02:05.527Z","dependency_job_id":null,"html_url":"https://github.com/eknkc/dateformat","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/eknkc/dateformat","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eknkc%2Fdateformat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eknkc%2Fdateformat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eknkc%2Fdateformat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eknkc%2Fdateformat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eknkc","download_url":"https://codeload.github.com/eknkc/dateformat/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eknkc%2Fdateformat/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266535695,"owners_count":23944275,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"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":["dateformat","go","language","time"],"created_at":"2024-11-06T15:14:10.440Z","updated_at":"2025-07-22T17:03:41.357Z","avatar_url":"https://github.com/eknkc.png","language":"Go","readme":"# dateformat\n--\n    import \"github.com/eknkc/dateformat\"\n\nDateFormat provides convenient date formatting with localization support. Built in support for French, German, Spanish, Dutch, Turkish and English\n\n## Usage\n\n```go\nvar Dutch dutch\n```\nDutch language locale that can be used as \"FormatLocale\" parameter\n\n```go\nvar English english\n```\nEnglish language locale that can be used as \"FormatLocale\" parameter\n\n```go\nvar French french\n```\nFrench language locale that can be used as \"FormatLocale\" parameter\n\n```go\nvar German german\n```\nGerman language locale that can be used as \"FormatLocale\" parameter\n\n```go\nvar Spanish spanish\n```\nSpanish language locale that can be used as \"FormatLocale\" parameter\n\n```go\nvar Turkish turkish\n```\nTurkish language locale that can be used as \"FormatLocale\" parameter\n\n#### func  Format\n\n```go\nfunc Format(t time.Time, format string) string\n```\nFormats given date in \"English\" locale. See FormatLocale for details.\n\n#### func  FormatLocale\n\n```go\nfunc FormatLocale(t time.Time, format string, locale DateLocale) string\n```\nFormats a given date according to the format string and date locale. Format\nstrings are specified like MMMM Do YYYY, h:mm:ss a, which would yield October\n24th 2012, 12:42:03 am in English locale. Supported format string tokens:\n\n    Month\n    \tM: 1 2 ... 12\n    \tMM: 01 01 ... 12\n    \tMo: 1st 2nd ... 12th\n    \tMMM: Jan Feb ... Dec\n    \tMMMM: January February ... December\n    Day of Month\n    \tD: 1 2 ... 31\n    \tDD: 01 02 ... 31\n    \tDo: 1st 2nd ... 31st\n    Day of Week\n    \tddd: Sun Mon ... Sat\n    \tdddd: Sunday Monday ... Saturday\n    Year\n    \tYY: 70 71 ... 12\n    \tYYYY: 1970 1971 ... 2012\n    Hour\n    \tH: 0 1 2 ... 23\n    \tHH: 00 01 02 .. 23\n    \th: 1 2 ... 12\n    \thh: 01 02 ... 12\n    Minute\n    \tm: 0 1 2 ... 59\n    \tmm: 00 01 02 ... 59\n    Second\n    \ts: 0 1 2 ... 59\n    \tss: 00 01 02 ... 59\n    AM / PM\n    \tA: AM PM\n    \ta: am pm\n    Timezone\n    \tZ: -07:00 -06:00 ... +07:00\n    \tZZ: -0700 -0600 ... +0700\n    Escaping\n    \tIt is possible to place arbitrary text within [] to display it as it is.\n    Sample:\n    \tMMMM Do YYYY, h:mm:ss a [Foo] -\u003e October 24th 2012, 1:52:27 am Foo\n\n#### func  FormatMagic\n\n```go\nfunc FormatMagic(t time.Time, magic string, locale DateLocale) string\n```\nUses built in time package semantics for format string, that is a magic date.\nInstead of \"MM\", \"H\" style tokens that Format function accepts, you can supply a\nsample date as \"magic\" parameter And it will be figured out as the format. Given\nmagic date layout must be\n\n    Mon Jan 2 15:04:05 MST 2006\n\nThat is\n\n    01/02 03:04:05PM '06 -0700\n\nin a more memorable layout.\n\n    Sample:\n    magic = Mon, 02 Jan 2006 15:04:05 -0700\n    result = Wed, 24 Oct 2012  2:10:11 +0300\n\n#### type DateLocale\n\n```go\ntype DateLocale interface {\n\t// Return the long month name of given index (1 = January, 12 = December)\n\tMonthName(index int) string\n\t// Return the long weekday name of given index (0 = Sunday, 6 = Saturday)\n\tDayName(index int) string\n\t// Return the short month name of given index (1 = Jan, 12 = Dec)\n\tShortMonthName(index int) string\n\t// Return the short weekday name of given index (0 = Sun, 6 = Sat)\n\tShortDayName(index int) string\n\t// Return the ordinal value (1 = 1st, 2 = 2nd)\n\tOrdinal(num int) string\n}\n```\n\nDateLocale specifies how to format dates in different languages. FormatLocale\nfunction accepts a DateLocale instance and formats the date according to given\nlocale.\n\nDeveloped By\n============\n\nEkin Koc - \u003cekin@eknkc.com\u003e\n\nLicense\n=======\n\n    Copyright 2012 Ekin Koc\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feknkc%2Fdateformat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feknkc%2Fdateformat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feknkc%2Fdateformat/lists"}