https://github.com/glorywong/iso-timestamp
Generate ISO 8601 timestamp: YYYYMMDDhhmmssSSS
https://github.com/glorywong/iso-timestamp
iso-8601 timestamp
Last synced: 26 days ago
JSON representation
Generate ISO 8601 timestamp: YYYYMMDDhhmmssSSS
- Host: GitHub
- URL: https://github.com/glorywong/iso-timestamp
- Owner: GloryWong
- License: mit
- Created: 2024-08-06T16:47:50.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2025-04-06T22:07:24.000Z (6 months ago)
- Last Synced: 2025-04-06T23:19:34.784Z (6 months ago)
- Topics: iso-8601, timestamp
- Language: TypeScript
- Homepage:
- Size: 292 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README












# iso-timestamp
Generate ISO 8601 timestamp: YYYYMMDDhhmmssSSS
### Install
```bash
npm install iso-timestamp
```or
```bash
yarn add iso-timestamp
```or
```bash
pnpm add iso-timestamp
```### API
#### `timestamp(options?)` or `timestamp(date, options?)`
* `date`: Custom date
* options:
* `excludeTime`: Exclude time, i.e. hour, minute and second. *Default: false*
* `excludeMillisecond`: Exclude millisecond from time. *Default: false*
* `separator`: Separator among elements of the timestamp. *Default: ''*```typescript
import timestamp from 'iso-timestamp'
// Or import { timestamp } from 'iso-timestamp'timestamp()
// return current timestamp: 202408070101123timestamp({ excludeMillisecond: true })
// return timestamp with millisecond excluded: 202408070101timestamp({ excludeTime: true })
// return timestamp with time excluded: 20240807timestamp(new Date('2050-03-04T12:03:04.123'), { excludeMillisecond: true })
// return timestamp with custom Date: 20500304120304timestamp({ separator: '-', excludeTime: true })
// return timestamp with custom separator: 2024-08-07
```## Authors
👤 **GloryWong**
* Website: https://glorywong.com
* GitHub: [@GloryWong](https://github.com/GloryWong)## Show Your Support
Give a ⭐️ if this project helped you!