Skip to content

Instantly share code, notes, and snippets.

View joaquinhojman's full-sized avatar

Joaquin Hojman joaquinhojman

View GitHub Profile
@sadikovi
sadikovi / utc_date.rs
Last active November 18, 2024 11:01
Convert timestamp in seconds into datetime in UTC as Rust function
use std::fmt;
#[derive(Clone, Debug)]
pub struct DateTime {
/// Seconds after the minute - [0, 59]
pub sec: i32,
/// Minutes after the hour - [0, 59]
pub min: i32,
/// Hours after midnight - [0, 23]
pub hour: i32,