dtime 1.0.2

A professional, cross-platform datetime display utility with colored output and millisecond precision
Documentation
# dtime

[![Crates.io](https://img.shields.io/crates/v/dtime.svg)](https://crates.io/crates/dtime)
[![Documentation](https://docs.rs/dtime/badge.svg)](https://docs.rs/dtime)
[![License](https://img.shields.io/crates/l/dtime.svg)](LICENSE)

A professional, cross-platform datetime display utility with colored output and millisecond precision.

## Features

- 🕒 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

## Installation

### From Crates.io

```bash
cargo install dtime
```

### From Source

```bash
git clone https://github.com/cumulus13/dtime.git
cd dtime
cargo install --path .
```

## Usage

### Basic Usage

```bash
# Display current datetime (colored output by default)
dtime

# Plain text output
dtime --format plain

# JSON output
dtime --format json

# Disable colors
dtime --no-color
```

### Advanced Options

```bash
# 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
```

## Output Examples

### Colored Output (Default)
```
╔══════════════════════════════════════════════════╗
║         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                              │
└──────────────────────────────────────────────────┘
```

### JSON Output
```json
{
  "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"
}
```

## Using as a Library

Add to your `Cargo.toml`:

```toml
[dependencies]
dtime = "0.1"
```

```rust
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);
}
```

## License

Licensed under either of:
- MIT license ([LICENSE-MIT]LICENSE-MIT or http://opensource.org/licenses/MIT)
- Apache License, Version 2.0 ([LICENSE-APACHE]LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)

at your option.

## 👤 Author
        
[Hadi Cahyadi](mailto:cumulus13@gmail.com)
    

[![Buy Me a Coffee](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/cumulus13)

[![Donate via Ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/cumulus13)
 
[Support me on Patreon](https://www.patreon.com/cumulus13)

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.