pub struct DateTime {
pub year: u64,
pub month: u64,
pub day: u64,
pub hour: u64,
pub minute: u64,
pub second: u64,
pub timezone: TimeZone,
}
Expand description
Struct for holding the full date and time information.
Fields§
§year: u64
§month: u64
§day: u64
§hour: u64
§minute: u64
§second: u64
§timezone: TimeZone
Implementations§
Source§impl DateTime
impl DateTime
Sourcepub fn new(
year: u64,
month: u64,
day: u64,
hour: u64,
minute: u64,
second: u64,
timezone: TimeZone,
) -> Result<Self, String>
pub fn new( year: u64, month: u64, day: u64, hour: u64, minute: u64, second: u64, timezone: TimeZone, ) -> Result<Self, String>
Creates a new DateTime
object.
Sourcepub fn calculate_total_seconds(
year: u64,
month: u64,
day: u64,
hour: u64,
minute: u64,
second: u64,
) -> Result<i64, String>
pub fn calculate_total_seconds( year: u64, month: u64, day: u64, hour: u64, minute: u64, second: u64, ) -> Result<i64, String>
Calculate the total seconds since Unix Epoch (1970-01-01 00:00:00)
pub fn strftime(&self, format: &str) -> String
pub fn to_unix_seconds(&self) -> i64
pub fn from_unix_seconds( unix_seconds: i64, timezone: TimeZone, ) -> Result<Self, String>
pub fn add_timedelta(&self, delta: TimeDelta) -> Result<Self, String>
pub fn sub_timedelta(&self, delta: TimeDelta) -> Result<Self, String>
Trait Implementations§
impl Copy for DateTime
Auto Trait Implementations§
impl Freeze for DateTime
impl RefUnwindSafe for DateTime
impl Send for DateTime
impl Sync for DateTime
impl Unpin for DateTime
impl UnwindSafe for DateTime
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more