Crate datetimeutils

Source

Structs§

PostEpochTime
Conceptually this is a thin wrapper for std::time::SystemTime, but provides more useful functions. The impl of this struct has functions that allow easily extracting the year/month/date/etc. for the given point in time. In actual fact the internal representation of this struct is a Duration since the unix epoch, so that error-handling is only required once upon creating the instance, and not for each attempt at extracting date/time fields.

Enums§

Day
Enum with the seven days of the week.
Month
Enum with the months of the year.

Functions§

day_abbrev_string
Maps the Day enum to a shortened string representation, e.g. “Mon”.
day_string
Maps the Day enum to a string representation, e.g. “Monday”.
days_in_month
Takes in a year and month (e.g. 2020, February) and returns the number of days in that month.
days_in_year
Takes in a year (e.g. 2019) and returns the number of days in that year.
index_from_month
Converts a Month enum to an integer in the range 1-12.
month_abbrev_string
Maps the Month enum to a shortened string representation, e.g. “Jan”.
month_from_index
Converts an integer in the range 1-12 into the corresponding Month enum. Values outside the 1-12 range are converted to None.
month_string
Maps the Month enum to a string representation, e.g. “January”.
seconds_in_day
Returns the number of seconds in a day.
seconds_in_hour
Returns the number of seconds in an hour.
seconds_in_minute
Returns the number of seconds in a minute.