iceyee_datetime

Crates.ioiceyee_datetime
lib.rsiceyee_datetime
version3.0.0
sourcesrc
created_at2022-11-09 01:31:56.222168
updated_at2023-11-16 02:29:30.316265
descriptionDatetime.
homepage
repositoryhttps://github.com/iceyee/rust_iceyee/tree/main/iceyee_datetime/
max_upload_size
id708423
size22,291
Iceyee (iceyee)

documentation

README

iceyee_datetime

Supported Os

  • linux
  • macos
  • windows

Example

#[test]
fn test_datetime() {
    use iceyee_datetime::DateTime;
    println!("");
    println!("@TIME_OFFSET={:?}", unsafe { iceyee_datetime::TIME_OFFSET });
    println!("DateTime::now()={}", DateTime::now());
    let dt_new = DateTime::new();
    println!("DateTime::new()=\n{}", dt_new.to_string());
    let dt_new_utc = dt_new.to_utc();
    println!("DateTime::new().to_utc()=\n{}", dt_new_utc.to_string());
    let dt_new_from = DateTime::from((
        dt_new.year,
        dt_new.month,
        dt_new.day,
        dt_new.hour,
        dt_new.minute,
        dt_new.second,
        Some(dt_new.offset),
    ));
    println!("DateTime::new()::from()=\n{}", dt_new_from.to_string());
    let dt_new_utc_from = DateTime::from((
        dt_new_utc.year,
        dt_new_utc.month,
        dt_new_utc.day,
        dt_new_utc.hour,
        dt_new_utc.minute,
        dt_new_utc.second,
        Some(dt_new_utc.offset),
    ));
    println!(
        "DateTime::new().to_utc()::from()=\n{}",
        dt_new_utc_from.to_string()
    );
    return;
}
test test_datetime ...
@TIME_OFFSET=Some(800)
DateTime::now()=1668051555891
DateTime::new()=
2022-11-10T11:39:15.891+08:00
DateTime::new().to_utc()=
2022-11-10T03:39:15.891Z
DateTime::new()::from()=
2022-11-10T11:39:15.0+08:00
DateTime::new().to_utc()::from()=
2022-11-10T03:39:15.0Z
Commit count: 0

cargo fmt