15 lines
392 B
Rust
15 lines
392 B
Rust
//! datetime — 本地时间
|
|
|
|
use chrono::Local;
|
|
|
|
fn main() {
|
|
let _ = std::io::stdin().read_line(&mut String::new());
|
|
let now = Local::now();
|
|
let out = serde_json::json!({
|
|
"type": "result",
|
|
"content": format!("当前时间: {}\n星期: {}\n时区: {}",
|
|
now.format("%Y-%m-%d %H:%M:%S"), now.format("%A"), now.offset())
|
|
});
|
|
println!("{out}");
|
|
}
|