Easily convert UTC timestamps into your local timezone and log the outputs automatically.
-
Clone the project:
git clone https://github.com/yourusername/timestamp-converter.git cd timestamp-converter -
Install dependencies:
npm install
You can provide timestamps in two ways:
node index.js "2025-08-23T20:28:20.213Z"Create a file named timestamps.json in the project root:
{
"timestamp": "2025-08-23T20:28:20.213Z"
}Run the script:
node index.js⚡ Note: If both a CLI timestamp and a JSON timestamp exist, the CLI timestamp will be used.
Logged entry: {
"id": "1729473600000-1b9d6b00-1234-5678-9abc-def123456789",
"utc": "2025-08-23T20:28:20.213Z",
"timezone": "America/New_York (Your current local time zone)",
"time_12h": "August 23, 2025, 04:28:20 PM",
"time_24h": "23 August 2025, 16:28:20",
"logged_at": "2025-08-23T20:28:20.213Z"
}
Every run is appended to a single log file (logs/history.log) which automatically rotates when it reaches 50KB.
This helps you keep history clean and organized.
- The script converts UTC timestamps into your system's local timezone.\
- If your system's timezone cannot be detected, the script will fall back to UTC (Greenwich Mean Time).
- Convert UTC → Local Timezone
- Supports both 12h (AM/PM) and 24h formats
- Works with CLI or
.jsoninput - Auto-logs history into
/logs - Graceful fallback to UTC if system timezone unavailable
- Node.js 16+
- npm
- Library:
uuid
Install uuid:
npm install uuidtimestamp-converter/
│── index.js
│── timestamps.json
│── logs/
│── package.json
│── USER_GUIDE.md
Enjoy converting timestamps hassle-free 🚀