devkits-timestamp-converter
v1.0.7
Published
Unix timestamp converter — convert timestamps to dates and back. CLI + API, zero dependencies.
Maintainers
Readme
devkits-timestamp-converter
Unix timestamp converter — convert timestamps to dates and back instantly.
💰 Support DevKits
Love these tools? Support development via Open Collective
- $5/mo - Supporter (priority support)
- $9/mo - Pro (early access to new tools)
- $29 - Lifetime (all current + future Pro features)
Install
npm install -g devkits-timestamp-converterUsage
CLI
# Timestamp to date
timestamp-converter --to-date 1709251200
# Date to timestamp
timestamp-converter --to-timestamp "2024-03-01 12:00:00"
# Current timestamp
timestamp-converter --now
# Short aliases
ts-convert -d 1709251200
ts-convert -t "2024-03-01"
epoch --nowAPI
const { toDate, toTimestamp, now } = require('devkits-timestamp-converter');
// Timestamp to date
const date = toDate(1709251200);
console.log(date.iso); // ISO format
console.log(date.local); // Local format
console.log(date.date); // YYYY-MM-DD
// Date to timestamp
const ts = toTimestamp('2024-03-01');
console.log(ts.seconds);
// Current timestamp
const nowTs = now();Features
- Auto-detect seconds/milliseconds
- Multiple output formats
- Timezone support
- Zero dependencies
Links
License
MIT
