{"id":28034865,"url":"https://github.com/beliumgl/datepp","last_synced_at":"2025-10-06T23:50:23.227Z","repository":{"id":292009088,"uuid":"979519244","full_name":"beliumgl/datepp","owner":"beliumgl","description":"Date \u0026 Time Library for C++11","archived":false,"fork":false,"pushed_at":"2025-05-07T18:11:19.000Z","size":23,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-11T11:58:47.174Z","etag":null,"topics":["cpp","cpp11","date","datetime"],"latest_commit_sha":null,"homepage":"","language":"C++","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/beliumgl.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,"zenodo":null}},"created_at":"2025-05-07T16:30:14.000Z","updated_at":"2025-05-07T18:11:22.000Z","dependencies_parsed_at":"2025-05-11T11:58:48.580Z","dependency_job_id":"2f8d471c-c4a9-46c5-9a5e-326674fc9314","html_url":"https://github.com/beliumgl/datepp","commit_stats":null,"previous_names":["beliumgl/datepp"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/beliumgl/datepp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beliumgl%2Fdatepp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beliumgl%2Fdatepp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beliumgl%2Fdatepp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beliumgl%2Fdatepp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/beliumgl","download_url":"https://codeload.github.com/beliumgl/datepp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beliumgl%2Fdatepp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278698806,"owners_count":26030398,"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-10-06T02:00:05.630Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","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":["cpp","cpp11","date","datetime"],"created_at":"2025-05-11T11:58:45.865Z","updated_at":"2025-10-06T23:50:23.196Z","avatar_url":"https://github.com/beliumgl.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Date and Time Manager for Unix Timestamps\n\n*A single-header C++11 library for parsing, formatting, and managing Unix timestamps-including negative values (dates before 1970).*\n\n---\n\n## Features\n\n- **Handles both positive and negative Unix timestamps** (dates before and after 1970)\n- **Customizable date/time formatting**  \n  Choose order (MDY, DMY, YMD), delimiter, show/hide day of week, time, UTC offset, use 12/24-hour time, month as number or name, and zero-padding\n- **Timezone offset support**\n- **Operator overloading** for date comparison and arithmetic\n- **Zero dependencies** beyond the C++11 standard library\n\n---\n\n## Quick Start\n\n### 1. Include the Header\n\n```cpp\n#include \"datepp.hpp\"\n```\n\n### 2. Create and Use a DateTime\n\n```cpp\n#include \n#include \"datepp.hpp\"\n\nint main() {\n    beliumgl::DateTime d(\"1700000000\"); // Unix timestamp as string\n    std::cout \u003c\u003c d.toString() \u003c\u003c std::endl; // Default format\n}\n```\n\n### 3. Custom Formatting\n\n```cpp\nbeliumgl::DateTimeFormat fmt(\"W, DD.MM.YYYY HH:II:SS O UTC\");\nstd::cout \u003c\u003c dt.toString(fmt) \u003c\u003c std::endl;\n```\n\n---\n\n## How Does the String Format Work?\n\n- **Case-insensitive:** You can use upper or lower case letters; it doesn't matter.\n- **Unknown characters are ignored** (except when used as delimiters).\n- **Delimiter:** The delimiter will be the last character separating D, M (or A), and Y in your format string.\n\n### Tokens\n\nThe format string uses the following tokens:\n\n| Token | Meaning              | Note                                     |\n|-------|----------------------|------------------------------------------|\n| W     | Day of the week      | Use `WW` for full names                  |\n| D     | Day                  | Use `DD` for zero-padded day             |\n| M     | Month (number)       | Use `MM` for zero-padded month           |\n| Y     | Year                 | Use `YY` for zero-padded year            |\n| H     | Hour                 |                                          |\n| I     | Minute               | `'I'` is used because `'M'` is for month |\n| S     | Second               |                                          |\n| O     | UTC offset           |                                          |\n| _     | 12-hour format       |                                          |\n| A     | Alphabetical month   |             |\n\n### Special Patterns\n\n- `WW` - Show the full name of the day of the week (e.g., \"Thursday\").\n- `DD`, `MM`, `YY` - Fill with zeros (e.g., \"01\", \"09\", \"05\").\n- Single token (e.g., `D`, `M`, `Y`) - Short names or no leading zeros.\n\n- NOTES: If there are at least one DD or MM or HH, etc., then date and time will also be filled with zeros. If any of H, I, or S is specified, the resulting string will still include all hours, minutes, and seconds.\n### Format Order\n\n- **The order of D, M (or A), and Y is important!**\n    - For example, `MM/DD/YY` and `DD/MM/YY` will be interpreted differently.\n\n### Optional Tokens\n\n- `H`, `I`, `S`, `W`, `O`, `_`, and `A` are **not required** in the format.\n- Omitting them will result in the loss of some information (e.g., time, UTC offset, time format, etc.).\n\n---\n\n**Example format:**  \n`\"W, DD/MM/YY, HH:II:SS O\"`  \n- This would display something like: `Thu, 01/01/1970, 00:00:00 +00 UTC`\n---\n\n## API Overview\n\n### `DateTimeFormat`\n- Customize how dates are displayed\n- Example:\n  ```cpp\n  beliumgl::DateTimeFormat fmt(\"DD.MM.YYYY\");\n  ```\n\n### `DateTime`\n- Construct from Unix timestamp (string or char*)\n- Convert to string in your chosen format\n- Get individual components: year, month, day, hour, minute, second, day of week, UTC offset\n- Operator overloads: compare, add, subtract, multiply, divide dates\n\n---\n\n## Example Usage\n\n```cpp\nbeliumgl::DateTime d(\"1700000000\", 2.0); // timestamp, UTC+2\nstd::cout \u003c\u003c d.toString(\"W, DD/MM/YY HH:II:SS O UTC\") \u003c\u003c std::endl;\n```\n\n---\n\n## Notes\n\n- **Month and day are zero-based internally** (January = 0, first day = 0), but formatted output is 1-based.\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeliumgl%2Fdatepp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeliumgl%2Fdatepp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeliumgl%2Fdatepp/lists"}