📚Cheatsheets

Cheatsheet collection for go, rust, python, shell and javascript.

Convert date to ISO date in Rust

Add chrono to your project.

cargo add chrono

Convert the date.

use chrono::{DateTime, Utc};
use std::time::SystemTime;

fn iso_date() -> String {
    let now = SystemTime::now();
    let now: DateTime<Utc> = now.into();
    return now.to_rfc3339();
}

// 2022-11-23T07:49:18.054044+00:00