{"id":15028021,"url":"https://github.com/alphp/strftime","last_synced_at":"2025-04-12T20:42:04.822Z","repository":{"id":41752326,"uuid":"469240134","full_name":"alphp/strftime","owner":"alphp","description":"This provides a cross-platform alternative to strftime() for when it will be removed from PHP","archived":false,"fork":false,"pushed_at":"2024-11-19T14:02:45.000Z","size":71,"stargazers_count":39,"open_issues_count":1,"forks_count":14,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-04T00:06:23.551Z","etag":null,"topics":["backward-compatibility","php","php-81","strftime"],"latest_commit_sha":null,"homepage":"","language":"PHP","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/alphp.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-03-13T01:21:31.000Z","updated_at":"2025-03-18T09:49:56.000Z","dependencies_parsed_at":"2024-06-18T18:18:51.663Z","dependency_job_id":"71fe1c05-7ff8-483d-947d-5bb36b7583de","html_url":"https://github.com/alphp/strftime","commit_stats":{"total_commits":60,"total_committers":9,"mean_commits":6.666666666666667,"dds":"0.41666666666666663","last_synced_commit":"d115595bccd137660d25e9e05fb656143594b404"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alphp%2Fstrftime","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alphp%2Fstrftime/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alphp%2Fstrftime/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alphp%2Fstrftime/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alphp","download_url":"https://codeload.github.com/alphp/strftime/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248631668,"owners_count":21136554,"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","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":["backward-compatibility","php","php-81","strftime"],"created_at":"2024-09-24T20:07:29.524Z","updated_at":"2025-04-12T20:42:04.795Z","avatar_url":"https://github.com/alphp.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![GitHub Workflow](https://github.com/alphp/strftime/actions/workflows/php.yml/badge.svg)](https://github.com/alphp/strftime/actions/workflows/php.yml)\n[![GitHub license](https://img.shields.io/github/license/alphp/strftime)](https://github.com/alphp/strftime/blob/master/LICENSE)\n[![GitHub release](https://img.shields.io/github/release/alphp/strftime)](https://github.com/alphp/strftime/releases)\n[![Packagist](https://img.shields.io/packagist/v/php81_bc/strftime)](https://packagist.org/packages/php81_bc/strftime)\n[![Packagist Downloads](https://img.shields.io/packagist/dt/php81_bc/strftime)](https://packagist.org/packages/php81_bc/strftime/stats)\n[![GitHub issues](https://img.shields.io/github/issues/alphp/strftime)](https://github.com/alphp/strftime/issues)\n[![GitHub forks](https://img.shields.io/github/forks/alphp/strftime)](https://github.com/alphp/strftime/network)\n[![GitHub stars](https://img.shields.io/github/stars/alphp/strftime)](https://github.com/alphp/strftime/stargazers)\n\n# strftime\nLocale-formatted strftime using IntlDateFormatter (PHP 8.1 compatible)\n\nThis provides a cross-platform alternative to strftime() for when it will be removed from PHP.\n\nNote that output can be slightly different between libc sprintf and this function as it is using ICU.\n\nOriginal code: https://gist.github.com/bohwaz/42fc223031e2b2dd2585aab159a20f30\n\nOriginal autor: [BohwaZ](https://bohwaz.net/)\n\n# Table of contents\n- [Requirements](#requirements)\n- [Installation](#installation)\n  - [Composer install](#composer-install)\n  - [Manual install](#manual-install)\n- [Usage](#usage)\n  - [Original use](#original-use)\n- [Formats](#formats)\n  - [Day](#day)\n  - [Week](#week)\n  - [Month](#month)\n  - [Year](#year)\n  - [Time](#time)\n  - [Time and Date Stamps](#time-and-date-stamps)\n  - [Miscellaneous](#miscellaneous)\n\n## Requirements\n- PHP \u003e= 7.1.0\n- ext-intl ([Internationalization extension ICU](https://www.php.net/manual/en/book.intl.php))\n\n[TOC](#table-of-contents)\n\n## Installation\n\n### Composer install\nYou can install this plugin into your application using [composer](https://getcomposer.org):\n\n- Add php81_bc/strftime package to your project:\n  ```bash\n    composer require php81_bc/strftime\n  ```\n\n- Load the function PHP81_BC\\strftime in your project\n  ```php\n  \u003c?php\n    require 'vendor/autoload.php';\n    use function PHP81_BC\\strftime;\n  ```\n\n[TOC](#table-of-contents)\n\n### Manual install\n- Download [php-8.1-strftime.php](https://github.com/alphp/strftime/raw/master/src/php-8.1-strftime.php) and save it to an accessible path of your project.\n- Load the function PHP81_BC\\strftime in your project\n  ```php\n  \u003c?php\n    require 'php-8.1-strftime.php';\n    use function PHP81_BC\\strftime;\n  ```\n\n[TOC](#table-of-contents)\n\n## Usage\n```php\n  use function PHP81_BC\\strftime;\n  echo strftime('%A %e %B %Y %X', new \\DateTime('2021-09-28 00:00:00'), 'fr_FR');\n```\n\n[TOC](#table-of-contents)\n\n### Original use\n```php\n  \\setlocale(LC_TIME, 'fr_FR.UTF-8');\n  echo \\strftime('%A %e %B %Y %X', strtotime('2021-09-28 00:00:00'));\n```\n\n[TOC](#table-of-contents)\n\n## Formats\n\n### Day\n| Format | Description                                            | Example returned values                         |\n|:------:|--------------------------------------------------------|-------------------------------------------------|\n|  `%a`  | An abbreviated textual representation of the day       | `Sun` through `Sat`                             |\n|  `%A`  | A full textual representation of the day               | `Sunday` through `Saturday`                     |\n|  `%d`  | Two-digit day of the month (with leading zeros)        | `01` to `31`                                    |\n|  `%e`  | Day of the month, with a space preceding single digits | `' 1'` to `'31'`                                    |\n|  `%j`  | Day of the year, 3 digits with leading zeros           | `001` to `366`                                  |\n|  `%u`  | ISO-8601 numeric representation of the day of the week | `1` (for `Monday`) through `7` (for `Sunday`)   |\n|  `%w`  | Numeric representation of the day of the week          | `0` (for `Sunday`) through `6` (for `Saturday`) |\n\n[TOC](#table-of-contents)\n### Week\n| Format | Description                                                                                                                                            | Example returned values                                        |\n|:------:|--------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------|\n|  `%U`  | Week number of the given year, starting with the first Sunday as the first week                                                                        | `13` (for the `13th full week of the year`)                    |\n|  `%V`  | ISO-8601:1988 week number of the given year, starting withthe first week of the year with at least 4 weekdays, with Monday being the start of the week | `01` through `53` (where 53 accounts for an overlapping week)  |\n|  `%W`  | A numeric representation of the week of the year, starting with the first Monday as the first week                                                     | `46` (for the `46th week of the year` beginning with a Monday) |\n\n**NOTE**: All week formats are two-digit, with leading zeros.\n\n[TOC](#table-of-contents)\n### Month\n| Format | Description                                                    | Example returned values                            |\n|:------:|----------------------------------------------------------------|----------------------------------------------------|\n|  `%b`  | Abbreviated month name, based on the locale                    | `Jan` through `Dec`                                |\n|  `%B`  | Full month name, based on the locale                           | `January` through `December`                       |\n|  `%h`  | Abbreviated month name, based on the locale (an alias of `%b`) | `Jan` through `Dec`                                |\n|  `%m`  | Two digit representation of the month                          | `01` (for `January`) through `12` (for `December`) |\n\n[TOC](#table-of-contents)\n### Year\n| Format | Description                                                                            | Example returned values                         |\n|:------:|----------------------------------------------------------------------------------------|-------------------------------------------------|\n|  `%C`  | Two digit representation of the century (year divided by 100, truncated to an integer) | `19` for the `20th Century`                     |\n|  `%g`  | Two digit representation of the year going by ISO-8601:1988 standards (see `%V`)       | Example: `09` for the week of `January 6, 2009` |\n|  `%G`  | The full four-digit version of `%g`                                                    | Example: `2009` for the `January 3, 2009`       |\n|  `%y`  | Two digit representation of the year                                                   | Example: `09` for `2009`, `79` for `1979`       |\n|  `%Y`  | Four digit representation for the year                                                 | Example: `2038`                                 |\n\n[TOC](#table-of-contents)\n### Time\n| Format | Description                                                                   | Example returned values                                |\n|:------:|-------------------------------------------------------------------------------|--------------------------------------------------------|\n|  `%H`  | Two digit representation of the hour in 24-hour format                        | `00` through `23`                                      |\n|  `%k`  | Hour in 24-hour format, with a space preceding single digits                  | `' 0'` through `'23'`                                      |\n|  `%I`  | Two digit representation of the hour in 12-hour format                        | `01` through `12`                                      |\n|  `%l`  | (lower-case 'L') Hour in 12-hour format, with a space preceding single digits | `' 1'` through `'12'`                                      |\n|  `%M`  | Two digit representation of the minute                                        | `00` through `59`                                      |\n|  `%p`  | UPPER-CASE '`AM`' or '`PM`' based on the given time                           | Example: `AM` for `00:31`, `PM` for `22:23`            |\n|  `%P`  | lower-case '`am`' or '`pm`' based on the given time                           | Example: `am` for `00:31`, `pm` for `22:23`            |\n|  `%r`  | Same as \"`%I:%M:%S %p`\"                                                       | Example: `09:34:17 PM` for `21:34:17`                  |\n|  `%R`  | Same as \"`%H:%M`\"                                                             | Example: `00:35` for `12:35 AM`, `16:44` for `4:44 PM` |\n|  `%S`  | Two digit representation of the second                                        | `00` through `59`                                      |\n|  `%T`  | Same as \"`%H:%M:%S`\"                                                          | Example: `21:34:17` for `09:34:17 PM`                  |\n|  `%X`  | Preferred time representation based on locale, without the date               | Example: `03:59:16` or `15:59:16`                      |\n|  `%z`  | The time zone offset                                                          | Example: `-0500` for `US Eastern Time`                 |\n|  `%Z`  | The time zone abbreviation                                                    | Example: `EST` for `Eastern Time`                      |\n\n[TOC](#table-of-contents)\n### Time and Date Stamps\n| Format | Description                                                     | Example returned values                                                  |\n|:------:|-----------------------------------------------------------------|--------------------------------------------------------------------------|\n|  `%c`  | Preferred date and time stamp based on locale                   | Example: `Tue Feb 5 00:45:10 2009` for `February 5, 2009 at 12:45:10 AM` |\n|  `%D`  | Same as \"`%m/%d/%y`\"                                            | Example: `02/05/09` for `February 5, 2009`                               |\n|  `%F`  | Same as \"`%Y-%m-%d`\" (commonly used in database datestamps)     | Example: `2009-02-05` for `February 5, 2009`                             |\n|  `%s`  | Unix Epoch Time timestamp (same as the `time()` function)       | Example: `305815200` for `September 10, 1979 08:40:00 AM`                |\n|  `%x`  | Preferred date representation based on locale, without the time | Example: `02/05/09` for `February 5, 2009`                               |\n\n[TOC](#table-of-contents)\n### Miscellaneous\n| Format | Description                          |\n|:------:|--------------------------------------|\n|  `%n`  | A newline character (\"\\n\")           |\n|  `%t`  | A Tab character (\"\\t\")               |\n|  `%%`  | A literal percentage character (\"%\") |\n\n[TOC](#table-of-contents)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falphp%2Fstrftime","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falphp%2Fstrftime","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falphp%2Fstrftime/lists"}