{"id":24966868,"url":"https://github.com/as400jplpc/zig_datetime","last_synced_at":"2025-08-23T15:16:35.084Z","repository":{"id":272700698,"uuid":"917478102","full_name":"AS400JPLPC/zig_datetime","owner":"AS400JPLPC","description":"DATE and TIMESTAMP field management","archived":false,"fork":false,"pushed_at":"2025-03-10T07:49:51.000Z","size":1849,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-10T08:22:09.701Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Zig","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/AS400JPLPC.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":"2025-01-16T04:05:24.000Z","updated_at":"2025-03-10T07:49:54.000Z","dependencies_parsed_at":"2025-02-28T21:21:12.908Z","dependency_job_id":"55c8d3da-db7c-4738-86b7-2a64984c1472","html_url":"https://github.com/AS400JPLPC/zig_datetime","commit_stats":null,"previous_names":["as400jplpc/zig_datetime"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AS400JPLPC%2Fzig_datetime","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AS400JPLPC%2Fzig_datetime/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AS400JPLPC%2Fzig_datetime/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AS400JPLPC%2Fzig_datetime/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AS400JPLPC","download_url":"https://codeload.github.com/AS400JPLPC/zig_datetime/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246128438,"owners_count":20727908,"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":[],"created_at":"2025-02-03T12:33:31.108Z","updated_at":"2025-08-23T15:16:35.056Z","avatar_url":"https://github.com/AS400JPLPC.png","language":"Zig","funding_links":[],"categories":[],"sub_categories":[],"readme":"**attention I use the night version 0.15.1 incompatible with 0.14.1**\n\n\n# Zig Datetime\n\nthank\n\n[![actions](frmdstryr/](https://github.com/frmdstryr/zig-datetime)\n\n\n\n## Table of Contents\n\n- [Usage](#usage)\n\n    - [Outils](#outils)\n\n    - [DateTime](#datetime)\n\n    - [Date](#date)\n\n    - [Timezone](#timezone)\n\n    - [Notes](#notes)\n\n    - [Avancement](#avancement)\n\n\n## Usage\n\n```zig\n\npub const Dte = @import(\"datetime\").Date;  // work date Y M D\n\npub const Dtm = @import(\"datetime\").DTime;  // UTC chronolog\n\npub const tmz = @import(\"timezones\");       // Time zones\n\n\nconst allocator = std.heap.page_allocator;\nconst date = try Dte.create(2019, 12, 25);\nconst next_year = date.shiftDays(7);\nassert(next_year.year == 2020);\nassert(next_year.month == 1);\nassert(next_year.day == 1);\nconst datuday= try. now(tmz.Europe.Paris);  // get milliTimestanp add timezones = YMD of day\n  \n// In UTC  milliTimestamp\nconst now = Dtm.now(tmz.Europe.Paris);\nstd.debug.print(\"formaChrono UTC : {s}\\n\",.{c.ChronoTime(allocator) catch \"0\" });\n// formaChrono UTC : 2025-01-14T:11:25:37N:0491Z:000\nstd.debug.print(\"formaChrono NUM : {d}\\n\",.{c.ChronoNum(allocator) catch 0 });\n// formaChrono NUM : 202501141125370491000\n\n```\n\u003cbr/\u003e\n\n## Notes  \n\n\u003cbr/\u003e\nthe time zone initialization process is performed once after each boot and only at the first function call. This is a principle used on the AS400 during OPDP (OPEN-DATA-SPACE).\u003cbr/\u003e\n\u003cbr/\u003e\nThis is a standard date processing library, plus a feature for SQL that supports a NULL zone.\u003cbr/\u003e\nSee examples in the zig_sql project.\u003cbr/\u003e\n\nIn SQL, there are two ways of handling dates:\u003cbr/\u003e\n“NULL”, e.g. invoicing not processed.\u003cbr/\u003e\n\n\n“0000-00-00” is not a valid date, it's just an indication, you shouldn't use it in your SQL.\u003cbr/\u003e\n\nThe date becomes invalid, for example when a record is “deinit”. \u003cbr/\u003e\nDte.DATE.dateOff(\u0026dfacture), becomes “0000-00-00” its status changes to false.\u003cbr/\u003e\n\nNormally, if you don't fiddle with the date apart from retrieving twisted text,\u003cbr/\u003e\nthere'll be no error, catch unreachable instead of tryv\n\nTo regenerate the timezone.zig file, run gensrc.sh from the create_timezones folder.\u003cbr/\u003e\nthis file is generated from timedatectl \u003cbr/\u003e\n\nisBad The “isBad” function checks for consistent date completeness\u003cbr/\u003e\n\nIf you use an uninitialized or already uninitialized field, or isBad this will trigger an @panic error.  --\u003e CRTL\u003cbr/\u003e\n\n\nTo be dynamic, an LMDB file is generated at each reboot only if the readTimezone() function is used.\u003cbr/\u003e\n\nTime-zone processing in source file ./liboffset/timeoffset.zig\u003cbr/\u003e\n\nsearchWeek” is a function that determines the number of weeks, the last week and the start of week 01.\u003cbr/\u003e\n\n\u003cbr/\u003e\n\n\n\n![](assets/20250116_012345_Testdate.png)\n\n\n![](assets/20250116_012345_Testzone.png)\n\n\u003cbr/\u003e\n\n## Outils\n\n|Function               | Description                              | Pub |\n|-----------------------|------------------------------------------|-----|\n|checkLeapYear          | is Leap Year                             |  .  |\n|dayInYear              | Number of days in the year               |  .  |\n|daysInMonth            | Number of days in the month              |  .  |\n|daysBeforeYear         | Number of days before Jan 1st of year    |  .  |\n|daysBeforeMonth        | Number of days   of the month precedent  |  .  |\n|isFile                 | openfileAbsolute lmdb                    |  .  |\n\n\n## DateTime\n\n\n|Function               | Description                              | Pub |\n|-----------------------|------------------------------------------|-----|\n|HardTime               | Change of field attribute                |  .  |\n|nowUTC                 | Timestamp date in UTC ONLY               |  x  |\n|nowTime                | Timestamp date into Time-zone            |  x  |\n|Timestamp              | Date time reverse  timestamp             |  x  |\n|NumTime                | Timestamp date into time-zone            |  x  |\n|stringTime             | Date-time format string                  |  x  |\n\n\n## Date\n\n|Function    | Description                                          | Pub |Panic|ctrl|\n|------------|------------------------------------------------------|-----|-----|----|\n|create      | Create and validate the date                         |  x  |  ?  |    |\n|dateOff     | Change status OFF for work SQL = null                |  x  |     |    |\n[isBad       | Consistency test of the date                         |  .  [  *  |    |\n|copy        | Return a copy of the date                            |  x  |  x  | x  |\n|HardDate    | Change of field attribute                            |  .  |     |    |\n|nowDate     | Returns today's date into time-zone   readTimezone() |  x  |     |    |\n|eql         | comparaison                                          |  x  |     | x  |\n|comp        | comparaison                                          |  x  |     | x  |\n|gt          | comparaison                                          |  x  |     | x  |\n|gte         | comparaison                                          |  x  |     | x  |\n|lt          | comparaison                                          |  x  |     | x  |\n|lte         | comparaison                                          |  x  |     | x  |\n|parseIso    | Parse date in format YYYY-MM-DD                      |  x  |  x  |    |\n|parseFR     | Parse date in format YYYY-MM-DD                      |  x  |  x  |    |\n|parseUS     | Parse date in format YYYY-MM-DD                      |  x  |  x  |    |\n|string      | Return date in ISO format YYYY-MM-DD                 |  .  |     | x  |\n|stringFR    | Return date in ISO format DD-MM-YYYY                 |  .  |     | x  |\n|stringUS    | Return date in ISO format MM-DD-YYYY                 |  .  |     | x  |\n|getYear     | get year                                             |  x  |     |    |\n|getMonth    | get Month                                            |  x  |     |    |\n|getDay      | get Day                                              |  x  |     |    |\n|getWeek     | get Week                                             |  x  |     |    |\n|getWeekDay  | get WeekDay                                          |  x  |     |    |\n|restOfdays  | get restOfdays                                       |  x  |     |    |\n|isWeekend   | Test Week end                                        |  x  |     |    |\n|isLeapYear  | is Leap Year                                         |  x  |     |    |\n|dayNum      | number of days                                       |  .  |     |    |\n|daysMore    | Add days                                             |  x  |     | x  |\n|daysLess    | Sub days                                             |  x  |     | x  |\n|yearsMore   | Add years                                            |  x  |     | x  |\n|yearsLess   | Sub years                                            |  x  |     | x  |\n|quantieme   | Returns the day number in the year                   |  x  |     | x  |\n|dayZeller   | Calculation of day number with Sunday = 01...        |  .  |     |    |\n|searchWeek  | Calculation week                                     |  .  |     |    |\n|fromOrdinal | Create a Date since 01-Jan-0001                      |  .  |  x  |    |\n|toOrdinal   | Return proleptic Gregorian ordinal                   |  .  |     |    |\n\n\n## Timezone\n\n|Function    | Description                                          | Pub |Panic|\n|------------|------------------------------------------------------|-----|-----|\n|abbrevDay   | Return the abbreviation name of the day              |  x  |     |\n|nameDay     | Return the of the day                                |  x  |     |\n|abbrevMonth | Return the abbreviation name of the Month            |  x  |     |\n|abbrevDay   | Return the abbreviation name of the day              |  x  |     |\n\n## Avancement\n\n-2025-01-16 06:30 start projet date-time \u003cbr/\u003e\n\n-2025-01-16 15:01 add function switchMonths \u003cbr/\u003e\n\n-2025-01-30 04:47 Formatting @panic and modifying isBad() deleting assert() \u003cbr/\u003e\n\n-2025-02-25 20:08 Complete overhaul of the DATE model \u003cbr/\u003e\n\n-2025-02-25 20:08 Dynamic timezone set-up \u003cbr/\u003e\n\n-2025-02-25 20:08 Automatic creation of timezone.zig source code, via the module: Creat_timezones \u003cbr/\u003e\n\n-2025-02-25 20:08 LMDB database creation \u003cbr/\u003e\n\n-2025-02-25 20:08 module timeoffset  \u003cbr/\u003e\n\n-2025-03-10 16:40 Resuming diagnostics with the better-understood 0.14.0 @src deciphering  \n  \n-2025-03-14 16:10 module timeoffsetAdd arena-allocator , standardization with string and decimal  \u003cbr/\u003e\n\n\n @panic  \u003cbr/\u003e  \n  \n-2025-08.22  02:10  update zig 0.15.1\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fas400jplpc%2Fzig_datetime","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fas400jplpc%2Fzig_datetime","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fas400jplpc%2Fzig_datetime/lists"}