A professional, cross-platform datetime display utility with colored output and millisecond precision.
- 🕒 Display local and UTC time with millisecond precision
- 📅 Unix timestamps in seconds and milliseconds
- 🌍 Timezone information with UTC offset
- 🎨 Beautiful colored output using true color (24-bit)
- 📊 Multiple output formats: colored, plain text, JSON
- 🔄 Monitor mode for real-time updates
- 🖥️ Cross-platform: Windows, Linux, macOS
- 🚀 Fast and lightweight
cargo install dtimegit clone https://github.com/cumulus13/dtime.git
cd dtime
cargo install --path .# Display current datetime (colored output by default)
dtime
# Plain text output
dtime --format plain
# JSON output
dtime --format json
# Disable colors
dtime --no-color# Show ISO 8601 format
dtime --iso
# Monitor mode (updates every 2 seconds)
dtime --monitor 2
# Custom timezone
dtime --timezone "Asia/Jakarta"
# Combine options
dtime --iso --format json╔══════════════════════════════════════════════════╗
║ SYSTEM TIME INFORMATION ║
╚══════════════════════════════════════════════════╝
┌──────────────────────────────────────────────────┐
│ Local Time: 2024-01-15 14:30:45.123 WIB │
│ UTC Time: 2024-01-15 07:30:45.123 UTC │
│ Unix Sec: 1705321845 │
│ Unix MS: 1705321845123 │
└──────────────────────────────────────────────────┘
╔══════════════════════════════════════════════════╗
║ TIMEZONE INFORMATION ║
╚══════════════════════════════════════════════════╝
┌──────────────────────────────────────────────────┐
│ Timezone: WIB │
│ Offset: +07:00 │
│ Weekday: Monday │
└──────────────────────────────────────────────────┘
{
"local_time": "2024-01-15 14:30:45.123 WIB",
"utc_time": "2024-01-15 07:30:45.123 UTC",
"unix_seconds": 1705321845,
"unix_milliseconds": 1705321845123,
"timezone": "WIB",
"offset": "+07:00",
"weekday": "Monday",
"iso_local": "2024-01-15T14:30:45.123+07:00",
"iso_utc": "2024-01-15T07:30:45.123Z"
}Add to your Cargo.toml:
[dependencies]
dtime = "0.1"use dtime::{DateTimeInfo, Config};
fn main() {
let config = Config::default();
let dt_info = DateTimeInfo::new(&config);
// Print colored output
println!("{}", dt_info.format_colored());
// Get JSON
let json = dt_info.format_json();
// Access individual fields
println!("Unix timestamp: {}", dt_info.unix_seconds);
}Licensed under either of:
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
at your option.
Contributions are welcome! Please feel free to submit a Pull Request.
