The words Under construction in black text on a yellow background with diagonal black stipes surrounding it
I'm in the process of moving my site. It's still a work in progress. Please excuse the mess and broken links.

Basic Date Parsing In Rust

TODO: Pull subtitle into page object
Code
//! ```cargo
//! [dependencies]
//! chrono = "0.4.31"
//! ```

use chrono::prelude::*;

fn main() {
  let date_string = "2023-12-21 13:46:47";
  let hour = 3600;
  let tz = FixedOffset::west_opt(5 * hour).unwrap();
  let ndt = NaiveDateTime::parse_from_str(date_string, "%Y-%m-%d %H:%M:%S")
    .unwrap()
    .and_local_timezone(tz)
    .unwrap();
  println!("{}", ndt);
}
Results
2023-12-21 13:46:47 +05:00

Debugging Stuff

I'm moving stuff around right now. All this below is helping me figure out where to put stuff

        -- title

Basic Date Parsing In Rust

-- code
-- rust

//! ```cargo
//! [dependencies]
//! chrono = "0.4.31"
//! ```

use chrono::prelude::*;

fn main() {
  let date_string = "2023-12-21 13:46:47";
  let hour = 3600;
  let tz = FixedOffset::west_opt(5 * hour).unwrap();
  let ndt = NaiveDateTime::parse_from_str(date_string, "%Y-%m-%d %H:%M:%S")
    .unwrap()
    .and_local_timezone(tz)
    .unwrap();
  println!("{}", ndt);
}

-- results/

2023-12-21 13:46:47 +05:00

-- /results


-- categories
-- Rust 

-- metadata
-- date: 2023-12-21 13:46:47
-- id: 2zre18ww
-- site: aws
-- type: post
-- status: published