{"id":23503503,"url":"https://github.com/realyuniquename/datetime","last_synced_at":"2026-01-23T07:05:01.992Z","repository":{"id":20785352,"uuid":"24070397","full_name":"RealyUniqueName/DateTime","owner":"RealyUniqueName","description":"Date/time (+math, +intervals) implementation for Haxe","archived":false,"fork":false,"pushed_at":"2024-02-21T07:46:03.000Z","size":1960,"stargazers_count":73,"open_issues_count":7,"forks_count":12,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-05-05T18:57:30.605Z","etag":null,"topics":["date","datetime","haxe","math","time","timezone"],"latest_commit_sha":null,"homepage":"http://doc.stablex.ru/datetime/index.html","language":"Haxe","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RealyUniqueName.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2014-09-15T19:25:36.000Z","updated_at":"2024-06-05T14:53:30.000Z","dependencies_parsed_at":"2024-02-21T08:48:16.711Z","dependency_job_id":null,"html_url":"https://github.com/RealyUniqueName/DateTime","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/RealyUniqueName/DateTime","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RealyUniqueName%2FDateTime","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RealyUniqueName%2FDateTime/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RealyUniqueName%2FDateTime/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RealyUniqueName%2FDateTime/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RealyUniqueName","download_url":"https://codeload.github.com/RealyUniqueName/DateTime/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RealyUniqueName%2FDateTime/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28682279,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T05:48:07.525Z","status":"ssl_error","status_checked_at":"2026-01-23T05:48:07.129Z","response_time":59,"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":["date","datetime","haxe","math","time","timezone"],"created_at":"2024-12-25T08:30:01.333Z","updated_at":"2026-01-23T07:05:01.973Z","avatar_url":"https://github.com/RealyUniqueName.png","language":"Haxe","funding_links":[],"categories":[],"sub_categories":[],"readme":"DateTime\n========\n\n[API docs](http://doc.stablex.ru/datetime/index.html)\n\nCustom date-time implementation for Haxe. Does not store milliseconds information. Contains classes and methods for manipulating intervals and date/time math.\n\n`DateTime` is an `abstract` type on top of `Float`, so it does not create any objects (unlike standard Haxe `Date` class) and saves you some memory :)\n\nAlso `DateTime` supports dates from 1 a.d. to 16 777 215 a.d. (maybe even more)\n\n`DateTime` is completely crossplatform, because it's written in plain Haxe.\n\n\nTimezones\n---------------\n`DateTime` uses IANA timezone database to deal with timezones: http://www.iana.org/time-zones\n\nLocal timezone detection code is a straightforward port of `jstimezonedetect` library: https://bitbucket.org/pellepim/jstimezonedetect.\nNotice: Read 'Limitations' of original library readme.\n\n\nPerformance\n---------------\nDepending on platfrom you target and methods of `DateTime` you use it can be up to 7 times faster than standard `Date` class or up to 10 times slower.\n\n\nTimezone database\n---------------\nUnless you reference `Timezone` class somewhere in your code, it will not be compiled. But you will still be able to get local time by `DateTime.local()` method.\n\nFull timezone database is ~116Kb. It becomes less then 50Kb when gziped by web server. Timezone database will be compiled into your binary only if you use `Timezone` class somewhere in your code.\n\nAdditionally you have an option to avoid embedding timezone database by providing a `-D EXTERNAL_TZ_DB` flag to Haxe compiler.\n\nYou can load timezone database at runtime from external sources (filesystem, web server, etc.) and pass it to `datetime.Timezone.loadData(data:String)` (where `data` is contents of `src/datetime/data/tz.dat` file)\n\nSince timezones can change several times every year because of various laws in different countries, perhaps you need to update timezones database using `haxelib run datetime` command ([or do it manually](https://github.com/RealyUniqueName/DateTime/blob/master/update_timezones.md))\n\nTimezone database is stored in `src/datetime/data/tz.dat` file of DateTime library.\n\n\nInstallation\n-------------\n`haxelib install datetime`\n\n\nExamples\n---------------\n```haxe\nvar utcNow = DateTime.now(); // Current date and time in UTC\n\nvar utc = DateTime.fromString('2014-09-19 01:37:45');\n//or\nvar utc : DateTime = '2014-09-19 01:37:45';\n//or\nvar utc = DateTime.fromTime(1411090665);\n//or\nvar utc : DateTime = 1411090665;\n//or\nvar utc = DateTime.make(2014, 9, 19, 1, 37, 45);\n//or\nvar utc = DateTime.fromDate( new Date(2014, 9, 19, 1, 37, 45) );\n//or\nvar utc : DateTime = new Date(2014, 9, 19, 1, 37, 45);\n\ntrace( utc.format('%F %T') );    // 2014-09-19 01:37:45\ntrace( utc.getYear() );          // 2014\ntrace( utc.isLeapYear() );       // false\ntrace( utc.getTime() );          // 1411090665\ntrace( utc.getMonth() );         // 9\ntrace( utc.getDay() );           // 19\ntrace( utc.getHour() );          // 1\ntrace( utc.getMinute() );        // 37\ntrace( utc.getSecond() );        // 45\ntrace( utc.getWeekDay() );       // 5\n\n//find last Sunday of current month\ntrace( utc.getWeekDayNum(Sunday, -1) ); // 2014-09-28 00:00:00\n\n//find DateTime of May in current year\nvar may : DateTime = utc.getMonthStart(May);\ntrace( may ); // 2014-05-01 00:00:00\n\n//snap to the beginning of current month\nutc.snap( Month(Down) );            // 2014-10-01 00:00:00\n//snap to next year\nutc.snap( Year(Up) );               // 2015-01-01 00:00:00\n//find next Monday\nutc.snap( Week(Up, Monday) );\n//find nearest Wednesday\nutc.snap( Week(Nearest, Wednesday) );\n\ntrace( utc.add(Year(1)) );       // 2014-09-19 -\u003e 2015-09-19\ntrace( utc + Year(1) );          // 2014-09-19 -\u003e 2015-09-19\n\ntrace( utc.add(Day(4)) );        // 2014-09-19 -\u003e 2014-09-23\ntrace( utc += Day(4) );          // 2014-09-19 -\u003e 2014-09-23\n\ntrace( utc.add(Minute(10)) );    // 01:37:45 -\u003e 01:47:45\ntrace( utc + Minute(10) );       // 01:37:45 -\u003e 01:47:45\n\ntrace( utc.add(Second(-40)) );   // 01:37:45 -\u003e 01:37:05\ntrace( utc - Second(40) );       // 01:37:45 -\u003e 01:37:05\n\ntrace( utc.add(Week(3)) );       // 2014-09-19 -\u003e 2014-10-10\ntrace( utc + Week(3) );          // 2014-09-19 -\u003e 2014-10-10\n\ntrace( utc.snap(Year(Down)) );           // 2014-01-01 00:00:00\ntrace( utc.snap(Year(Up)) );             // 2015-01-01 00:00:00\ntrace( utc.snap(Year(Nearest)) );        // 2015-01-01 00:00:00\ntrace( utc.snap(Week(Up, Wednesday)) );  // 2014-09-24 00:00:00\n\nvar utc2 : DateTime = '2015-11-19 01:37:45';\nvar dti  : DateTimeInterval = utc2 - utc;   //this interval now contains 1 year and 2 months\ntrace( dti.toString() );                    // (1y, 2m)\ntrace( utc + dti );                         // 2015-11-19 01:37:45\n\n//assuming your timezone has +4:00 offset\ntrace (utc.local());    // 2014-09-19 05:37:45\n\n//If timezones database is not embedded or you need to load an updated database\nvar data:String = ... //load from external source\nTimezone.loadData(data);\n\nvar tz = Timezone.local();\ntrace( tz.getName() );                  // Europe/Moscow\ntrace( tz.at(utc) );                    // 2014-09-19 05:37:45\ntrace( tz.format(utc, '%F %T %z %Z') ); // 2014-09-19 05:37:45 +0400 MSK\n\n```\nAnd much more: [API docs](http://doc.stablex.ru/datetime/index.html)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frealyuniquename%2Fdatetime","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frealyuniquename%2Fdatetime","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frealyuniquename%2Fdatetime/lists"}