Function dev_utils::conversion::datetime::now
source · pub fn now(timezone: i8) -> (u64, u8, u64, u64, u64, u64)Expand description
Returns the current date and time in the format: 2021-08-01 16:00:00
Example
use dev_utils::conversion::datetime::now; // Update the import path
(-12..=14).for_each(|i| { // Print all the hours from -12 to 14 (all possible timezones)
let (year, month, day, hour, minute, second) = dev_utils::conversion::datetime::now(i);
println!("{i:>4} -> {year:4}-{month:0>2}-{day:0>2} {hour:0>2}:{minute:0>2}:{second:0>2}");
});Panics
Panics if the timezone is not between -12 and 14.