{"_id":"timestamp-nano","_rev":"4652760","name":"timestamp-nano","description":"Timestamp for 64-bit time_t, nanosecond precision and strftime","dist-tags":{"latest":"1.0.1"},"maintainers":[{"name":"kawanet","email":"u-suke@kawa.net"}],"time":{"modified":"2026-04-10T20:49:00.000Z","created":"2017-11-27T09:54:31.524Z","1.0.1":"2022-12-17T07:54:12.987Z","1.0.0":"2018-10-18T18:17:42.715Z","0.1.4":"2017-12-18T06:39:34.709Z","0.1.3":"2017-12-03T08:13:32.561Z","0.1.2":"2017-12-01T04:54:48.175Z","0.1.1":"2017-11-29T01:43:15.500Z","0.1.0":"2017-11-27T09:54:31.524Z"},"users":{},"author":{"name":"@kawanet"},"repository":{"type":"git","url":"git+https://github.com/kawanet/timestamp-nano.git"},"versions":{"1.0.1":{"name":"timestamp-nano","description":"Timestamp for 64-bit time_t, nanosecond precision and strftime","version":"1.0.1","author":{"name":"@kawanet"},"browser":"./dist/timestamp.min.js","bugs":{"url":"https://github.com/kawanet/timestamp-nano/issues"},"contributors":[{"name":"Yusuke Kawasaki","email":"u-suke@kawa.net"},{"name":"Trevor Robinson","email":"tprobinson93@protonmail.com"}],"devDependencies":{"browserify":"^17.0.0","int64-buffer":"^1.0.1","jshint":"^2.13.6","mocha":"^10.2.0","nyc":"^15.1.0","strftime":"^0.10.1","typedoc":"^0.13.0","uglify-js":"^3.17"},"engines":{"node":">= 4.5.0"},"homepage":"https://github.com/kawanet/timestamp-nano#readme","jshintConifg":{"undef":true,"unused":true,"node":true},"keywords":["date","datetime","microsecond","nanosecond","strftime","time_t","timestamp"],"license":"MIT","main":"./timestamp.js","repository":{"type":"git","url":"git+https://github.com/kawanet/timestamp-nano.git"},"scripts":{"build":"make","fixpack":"fixpack","jshint":"jshint .","mocha":"mocha test/*.js","prepack":"npm run build && npm test","test":"make test","test-browser":"make test-browser"},"type":"commonjs","typings":"typings/timestamp.d.ts","gitHead":"b522467552963ba2b3f08060d55c2aa8bc64baa4","_id":"timestamp-nano@1.0.1","_nodeVersion":"18.12.1","_npmVersion":"8.19.2","dist":{"shasum":"be6eb118719504fcc3c7c732d2c461d3dd87da63","size":8004,"noattachment":false,"key":"/timestamp-nano/-/timestamp-nano-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/timestamp-nano/download/timestamp-nano-1.0.1.tgz"},"_npmUser":{"name":"kawanet","email":"u-suke@kawa.net"},"directories":{},"maintainers":[{"name":"kawanet","email":"u-suke@kawa.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/timestamp-nano_1.0.1_1671263652726_0.12651451602662211"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-12-17T07:54:16.604Z","publish_time":1671263652987,"_cnpm_publish_time":1671263652987},"1.0.0":{"name":"timestamp-nano","description":"Timestamp for 64-bit time_t, nanosecond precision and strftime","version":"1.0.0","author":{"name":"@kawanet"},"bugs":{"url":"https://github.com/kawanet/timestamp-nano/issues"},"devDependencies":{"coveralls":"^3.0.2","int64-buffer":"^0.99.1007","jshint":"^2.9.6","mocha":"^5.2.0","nyc":"^13.1.0","strftime":"^0.10.0","typedoc":"^0.13.0","uglify-js":"^3.3","zuul":"^3.12.0"},"engines":{"node":">= 4.5.0"},"homepage":"https://github.com/kawanet/timestamp-nano#readme","jshintConifg":{"undef":true,"unused":true,"node":true},"keywords":["date","datetime","microsecond","nanosecond","strftime","time_t","timestamp"],"license":"MIT","main":"timestamp.js","repository":{"type":"git","url":"git+https://github.com/kawanet/timestamp-nano.git"},"scripts":{"build":"make","coveralls":"nyc npm run mocha && ./node_modules/.bin/nyc report --reporter=text-lcov | ./node_modules/.bin/coveralls","fixpack":"fixpack","jshint":"jshint .","mocha":"mocha test/*.js","test":"make test","zuul-local":"zuul --open --local 4000 --ui mocha-bdd test/*.js"},"typings":"typings/timestamp.d.ts","gitHead":"01646ade9dacdb4dd0382fbc1eabcb2cf62b3e80","_id":"timestamp-nano@1.0.0","_shasum":"03bf0b43c2bdcb913a6a02fbaae6f97d68650f3a","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.11.1","_npmUser":{"name":"kawanet","email":"u-suke@kawa.net"},"dist":{"shasum":"03bf0b43c2bdcb913a6a02fbaae6f97d68650f3a","size":133887,"noattachment":false,"key":"/timestamp-nano/-/timestamp-nano-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/timestamp-nano/download/timestamp-nano-1.0.0.tgz"},"maintainers":[{"name":"kawanet","email":"u-suke@kawa.net"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/timestamp-nano_1.0.0_1539886662610_0.25949783757944966"},"_hasShrinkwrap":false,"publish_time":1539886662715,"_cnpm_publish_time":1539886662715,"_cnpmcore_publish_time":"2021-12-16T20:51:02.100Z"},"0.1.4":{"name":"timestamp-nano","description":"Timestamp for 64-bit time_t, nanosecond precision and strftime","version":"0.1.4","author":{"name":"@kawanet"},"bugs":{"url":"https://github.com/kawanet/timestamp-nano/issues"},"devDependencies":{"@types/mocha":"^2.2.44","@types/node":"^8.5.1","int64-buffer":"^0.1.10","jshint":"^2.9.5","mocha":"^4.0.1","strftime":"^0.10.0","typedoc":"^0.9.0","typescript":"^2.6.2","uglify-js":"^3.2.0","zuul":"^3.11.1"},"homepage":"https://github.com/kawanet/timestamp-nano#readme","jshintConifg":{"undef":true,"unused":true,"node":true},"keywords":["date","datetime","microsecond","nanosecond","strftime","time_t","timestamp"],"license":"MIT","main":"timestamp.js","repository":{"type":"git","url":"git+https://github.com/kawanet/timestamp-nano.git"},"scripts":{"build":"make","test":"make test"},"typings":"typings/timestamp.d.ts","gitHead":"5c16a9f4c77ac5434d5025d12fdff8dbbe89a356","_id":"timestamp-nano@0.1.4","_shasum":"25cae360a1eeeafb35e6d66c2b8d494a45de809e","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.11.1","_npmUser":{"name":"kawanet","email":"u-suke@kawa.net"},"dist":{"shasum":"25cae360a1eeeafb35e6d66c2b8d494a45de809e","size":134576,"noattachment":false,"key":"/timestamp-nano/-/timestamp-nano-0.1.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/timestamp-nano/download/timestamp-nano-0.1.4.tgz"},"maintainers":[{"name":"kawanet","email":"u-suke@kawa.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/timestamp-nano-0.1.4.tgz_1513579174603_0.768276150804013"},"directories":{},"publish_time":1513579174709,"_hasShrinkwrap":false,"_cnpm_publish_time":1513579174709,"_cnpmcore_publish_time":"2021-12-16T20:51:02.708Z"},"0.1.3":{"name":"timestamp-nano","description":"Timestamp for 64-bit time_t, nanosecond precision and strftime","version":"0.1.3","author":{"name":"@kawanet"},"bugs":{"url":"https://github.com/kawanet/timestamp-nano/issues"},"devDependencies":{"int64-buffer":"^0.1.10","jshint":"^2.9.5","mocha":"^4.0.1","strftime":"^0.10.0","typedoc":"^0.9.0","uglify-js":"^3.2.0","zuul":"^3.11.1"},"homepage":"https://github.com/kawanet/timestamp-nano#readme","jshintConifg":{"undef":true,"unused":true,"node":true},"keywords":["date","datetime","microsecond","nanosecond","strftime","time_t","timestamp"],"license":"MIT","main":"timestamp.js","repository":{"type":"git","url":"git+https://github.com/kawanet/timestamp-nano.git"},"scripts":{"build":"make","test":"make test"},"typings":"timestamp.d.ts","gitHead":"4b018e8796d0b16d41c87faf52e9489f9557c5a8","_id":"timestamp-nano@0.1.3","_shasum":"c3da700094f57e90767f6be4b386be815b376908","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.11.1","_npmUser":{"name":"kawanet","email":"u-suke@kawa.net"},"dist":{"shasum":"c3da700094f57e90767f6be4b386be815b376908","size":152256,"noattachment":false,"key":"/timestamp-nano/-/timestamp-nano-0.1.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/timestamp-nano/download/timestamp-nano-0.1.3.tgz"},"maintainers":[{"name":"kawanet","email":"u-suke@kawa.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/timestamp-nano-0.1.3.tgz_1512288812461_0.8659299944993109"},"directories":{},"publish_time":1512288812561,"_hasShrinkwrap":false,"_cnpm_publish_time":1512288812561,"_cnpmcore_publish_time":"2021-12-16T20:51:03.287Z"},"0.1.2":{"name":"timestamp-nano","description":"Timestamp for 64-bit time_t, nanosecond precision and strftime","version":"0.1.2","author":{"name":"@kawanet"},"bugs":{"url":"https://github.com/kawanet/timestamp-nano/issues"},"devDependencies":{"int64-buffer":"^0.1.9","jshint":"^2.9.5","mocha":"^4.0.1","strftime":"^0.10.0","typedoc":"^0.9.0","uglify-js":"^3.2.0","zuul":"^3.11.1"},"homepage":"https://github.com/kawanet/timestamp-nano#readme","jshintConifg":{"undef":true,"unused":true,"node":true},"keywords":["date","datetime","microsecond","nanosecond","strftime","time_t","timestamp"],"license":"MIT","main":"timestamp.js","repository":{"type":"git","url":"git+https://github.com/kawanet/timestamp-nano.git"},"scripts":{"build":"make","test":"make test"},"typings":"timestamp.d.ts","gitHead":"2f93d8341854033643142ccbfb4899c3f7778a87","_id":"timestamp-nano@0.1.2","_shasum":"ecb89e7be1abf2c943845954e210d6c8379057ff","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.11.1","_npmUser":{"name":"kawanet","email":"u-suke@kawa.net"},"dist":{"shasum":"ecb89e7be1abf2c943845954e210d6c8379057ff","size":152155,"noattachment":false,"key":"/timestamp-nano/-/timestamp-nano-0.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/timestamp-nano/download/timestamp-nano-0.1.2.tgz"},"maintainers":[{"name":"kawanet","email":"u-suke@kawa.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/timestamp-nano-0.1.2.tgz_1512104087972_0.335318292491138"},"directories":{},"publish_time":1512104088175,"_hasShrinkwrap":false,"_cnpm_publish_time":1512104088175,"_cnpmcore_publish_time":"2021-12-16T20:51:03.894Z"},"0.1.1":{"name":"timestamp-nano","description":"Timestamp for 64-bit time_t, nanosecond precision and strftime","version":"0.1.1","author":{"name":"@kawanet"},"bugs":{"url":"https://github.com/kawanet/timestamp-nano/issues"},"devDependencies":{"int64-buffer":"^0.1.9","jshint":"^2.9.5","mocha":"^4.0.1","strftime":"^0.10.0","typedoc":"^0.9.0","uglify-js":"^3.2.0","zuul":"^3.11.1"},"homepage":"https://github.com/kawanet/timestamp-nano#readme","jshintConifg":{"undef":true,"unused":true,"node":true},"keywords":["date","datetime","microsecond","nanosecond","strftime","time_t","timestamp"],"license":"MIT","main":"timestamp.js","repository":{"type":"git","url":"git+https://github.com/kawanet/timestamp-nano.git"},"scripts":{"build":"make","test":"make test"},"typings":"timestamp.d.ts","gitHead":"877e5ca2233f8eefbf19423be9d22d7b121dfe03","_id":"timestamp-nano@0.1.1","_shasum":"7c5cc6854ceaf35c79d765fe76cf950e8231039e","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.11.1","_npmUser":{"name":"kawanet","email":"u-suke@kawa.net"},"dist":{"shasum":"7c5cc6854ceaf35c79d765fe76cf950e8231039e","size":150393,"noattachment":false,"key":"/timestamp-nano/-/timestamp-nano-0.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/timestamp-nano/download/timestamp-nano-0.1.1.tgz"},"maintainers":[{"name":"kawanet","email":"u-suke@kawa.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/timestamp-nano-0.1.1.tgz_1511919795420_0.10128230787813663"},"directories":{},"publish_time":1511919795500,"_hasShrinkwrap":false,"_cnpm_publish_time":1511919795500,"_cnpmcore_publish_time":"2021-12-16T20:51:04.402Z"},"0.1.0":{"name":"timestamp-nano","description":"Timestamp for 64-bit time_t, nanosecond precision and strftime","version":"0.1.0","auther":"@kawanet","bugs":{"url":"https://github.com/kawanet/timestamp-nano/issues"},"devDependencies":{"int64-buffer":"^0.1.9","jsdoc":"^3.5.5","jshint":"^2.9.5","mocha":"^4.0.1","strftime":"^0.10.0","uglify-js":"^3.2.0","zuul":"^3.11.1"},"homepage":"https://github.com/kawanet/timestamp-nano#readme","jshintConifg":{"undef":true,"unused":true,"node":true},"keywords":["date","datetime","microsecond","nanosecond","strftime","time_t","timestamp"],"license":"MIT","main":"timestamp.js","repository":{"type":"git","url":"git+https://github.com/kawanet/timestamp-nano.git"},"scripts":{"build":"make","test":"make test"},"gitHead":"671dd8cb871985acd5b21ebc7722ac2768967bba","_id":"timestamp-nano@0.1.0","_shasum":"47e7a11bc6b65b4e0520b59fad4a295cd8ccd7ac","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.11.1","_npmUser":{"name":"kawanet","email":"u-suke@kawa.net"},"dist":{"shasum":"47e7a11bc6b65b4e0520b59fad4a295cd8ccd7ac","size":429866,"noattachment":false,"key":"/timestamp-nano/-/timestamp-nano-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/timestamp-nano/download/timestamp-nano-0.1.0.tgz"},"maintainers":[{"name":"kawanet","email":"u-suke@kawa.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/timestamp-nano-0.1.0.tgz_1511776471344_0.5172385305631906"},"directories":{},"publish_time":1511776471524,"_hasShrinkwrap":false,"_cnpm_publish_time":1511776471524,"_cnpmcore_publish_time":"2021-12-16T20:51:05.915Z"}},"readme":"# Timestamp for 64-bit time_t, nanosecond precision and strftime\n\n[![npm version](https://badge.fury.io/js/timestamp-nano.svg)](https://badge.fury.io/js/timestamp-nano)\n[![npm version](https://img.shields.io/npm/v/timestamp-nano)](https://www.npmjs.com/package/timestamp-nano)\n[![gzip size](https://img.badgesize.io/https://unpkg.com/timestamp-nano/dist/timestamp.min.js?compression=gzip)](https://unpkg.com/timestamp-nano/dist/timestamp.min.js)\n\nJavaScript's native `Date` will end at 275 thousand years later.\n64-bit signed `time_t` still works for 292 billion years, on the other hand.\n`Date` has only milliseconds precision since 20th century.\nNow we need longer range and higher precisions.\nTry **[Live Demo](https://kawanet.github.io/timestamp-nano/demo/index.html)** now!\n\n### Features\n\n- Longer range for `time_t`: `+292277026596-12-04T15:30:07Z`\n- Nanoseconds precision: `1970-01-01T00:00:00.000000001Z`\n- Bundled formatter: `\"%Y-%m-%dT%H:%M:%S.%NZ\"`, `\"%a, %b %d %X %Y %z (%Z)\"`\n- Small: just 3KB minified [timestamp.min.js](https://rawgit.com/kawanet/timestamp-nano/master/dist/timestamp.min.js) available for Web browsers.\n- No dependencies: no other module required. Portable pure JavaScript.\n\n### Synopsis\n\n```js\nvar Timestamp = require(\"timestamp-nano\");\n\nTimestamp.fromDate(new Date()).toJSON(); // => \"2017-11-26T13:36:22.213Z\"\n\nTimestamp.fromString(\"2017-11-26T13:36:22.213Z\").getTimeT(); // => 1511703382\n\n// 64-bit time_t\nTimestamp.fromTimeT(1511703382).writeInt64BE(); // => [0,0,0,0,90,26,195,86]\n\nTimestamp.fromInt64BE([0,0,0,0,90,26,195,86]).toDate().getUTCHours(); // => 13\n\n// nanoseconds precision\nTimestamp.fromInt64LE([86,195,26,90,0,0,0,0]).addNano(123456789).toJSON(); // => \"2017-11-26T13:36:22.123456789Z\"\n\nTimestamp.fromString(\"2017-11-26T13:36:22.123456789Z\").getNano(); // => 123456789\n```\n\n### Live Demo\n\n- [https://kawanet.github.io/timestamp-nano/demo/index.html](https://kawanet.github.io/timestamp-nano/demo/index.html)\n\n### Documentation\n\n- [https://kawanet.github.io/timestamp-nano/typedoc/classes/timestamp.html](https://kawanet.github.io/timestamp-nano/typedoc/classes/timestamp.html)\n\n### Format Specifiers\n\n`toString()` method accepts `strftime` specifier characters as below.\n\n- `%%` - Literal `%` character.\n- `%a` - Abbreviated weekday name: `Sun` to `Sat`\n- `%b` - Abbreviated month name: `Jan` to `Dec`\n- `%d` - Day: `01` to `31` (padded with zero)\n- `%e` - Day: ` 1` to `31` (padded with space)\n- `%F` - Equivalent to `%Y-%m-%d`\n- `%H` - Hour: `00` to `23`\n- `%L` - Milliseconds: `000` to `999`\n- `%M` - Minute: `00` to `59`\n- `%m` - Month: `01` to `12`\n- `%N` - Nanoseconds: `000000000` to `999999999`\n- `%n` - Newline character\n- `%R` - Equivalent to `%H:%M`\n- `%S` - Second: `00` to `59`\n- `%T` - Equivalent to `%H:%M:%S`\n- `%t` - Tab character\n- `%X` - Equivalent to `%T`\n- `%Y` - Year: `0000` to `9999`, or `+275760`, `-271821`, etc.\n- `%Z` - Constant timezone name: `GMT`\n- `%z` - Constant timezone offset: `+0000`\n\n### Node.js\n\n- [https://www.npmjs.com/package/timestamp-nano](https://www.npmjs.com/package/timestamp-nano)\n\n```sh\nnpm install timestamp-nano --save\n```\n\n### Browsers\n\n- [https://rawgit.com/kawanet/timestamp-nano/master/dist/timestamp.min.js](https://rawgit.com/kawanet/timestamp-nano/master/dist/timestamp.min.js)\n\n```html\n<script src=\"https://rawgit.com/kawanet/timestamp-nano/master/dist/timestamp.min.js\"></script>\n<script>\n  var dt = new Date();\n  var ts = Timestamp.fromDate(dt);\n  alert(ts.toString());\n</script>\n```\n\n### GitHub\n\n- [https://github.com/kawanet/timestamp-nano](https://github.com/kawanet/timestamp-nano)\n\n### See Also\n\n- [https://www.npmjs.com/package/int64-buffer](https://www.npmjs.com/package/int64-buffer) - for 64bit `time_t` long long value\n- [https://www.npmjs.com/package/strftime](https://www.npmjs.com/package/strftime) - for formatting with timezone or locale\n- [https://github.com/kawanet/cdate](https://github.com/kawanet/cdate) - cdate - a compact calendar date and strftime\n\n### The MIT License (MIT)\n\nCopyright (c) 2017-2022 Yusuke Kawasaki\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_attachments":{},"homepage":"https://github.com/kawanet/timestamp-nano#readme","bugs":{"url":"https://github.com/kawanet/timestamp-nano/issues"},"license":"MIT"}