| Crates.io | gostd_time |
| lib.rs | gostd_time |
| version | 1.1.3 |
| created_at | 2021-11-05 08:17:18.629171+00 |
| updated_at | 2025-04-16 09:04:50.057302+00 |
| description | Package time provides functionality for measuring and displaying time. time包提供了时间的显示和测量用的函数。日历的计算采用的是公历。 |
| homepage | https://github.com/wandercn/gostd |
| repository | https://github.com/wandercn/gostd |
| max_upload_size | |
| id | 477240 |
| size | 502,507 |
Package time provides functionality for measuring and displaying time. The calendrical calculations always assume a Gregorian calendar, with no leap seconds.
time包提供了时间的显示和测量用的函数。日历的计算采用的是公历。
fn main() {
use gostd_time as time;
let t = time::Date(2009, 11, 10, 14, 30, 12, 13, time::UTC.clone());
assert_eq!(
t.String(),
"2009-11-10 14:30:12.000000013 +0000 UTC".to_string()
);
assert_eq!(t.Format(time::RFC822), "10 Nov 09 14:30 UTC".to_string());
assert_eq!(
t.Format(time::RFC1123),
"Tue, 10 Nov 2009 14:30:12 UTC".to_string()
);
println!("default: {}", t);
println!("RFC822: {}", t.Format(time::RFC822));
println!("RFC1123: {}", t.Format(time::RFC1123));
}