lazytool 0.1.7

Rust lazy toolkit
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use lazytool::time;

fn main() {
    let dt = time::from_str("2025-01-15 18:16:13", "%Y-%m-%d %H:%M:%S").unwrap();
    println!("{dt:?}");

    let dt = time::from_str_with_timezone("2025-01-15 18:16:13", "%Y-%m-%d %H:%M:%S", "Asia/Shanghai").unwrap();
    println!("{dt:?}");

    let ts = time::to_timestamp("2025-01-15 18:16:13", "%Y-%m-%d %H:%M:%S").unwrap();
    println!("{ts}");

    let ts = time::current_timestamp();
    println!("{ts}");

}