#[non_exhaustive]pub struct DateTime {
pub day: Option<i32>,
pub hours: Option<i32>,
pub minutes: Option<i32>,
pub month: Option<i32>,
pub nanos: Option<i32>,
pub seconds: Option<i32>,
pub time_zone: Option<TimeZone>,
pub utc_offset: Option<Duration>,
pub year: Option<i32>,
/* private fields */
}region-zones or zones only.Expand description
Represents civil time (or occasionally physical time).
This type can represent a civil time in one of a few possible ways:
- When utc_offset is set and time_zone is unset: a civil time on a calendar day with a particular offset from UTC.
- When time_zone is set and utc_offset is unset: a civil time on a calendar day in a particular time zone.
- When neither time_zone nor utc_offset is set: a civil time on a calendar day in local time.
The date is relative to the Proleptic Gregorian Calendar.
If year, month, or day are 0, the DateTime is considered not to have a specific year, month, or day respectively.
This type may also be used to represent a physical time if all the date and
time fields are set and either case of the time_offset oneof is set.
Consider using Timestamp message for physical time instead. If your use
case also would like to store the user’s timezone, that can be done in
another field.
This type is more flexible than some applications may want. Make sure to document and validate your application’s limitations.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.day: Option<i32>Optional. Day of month. Must be from 1 to 31 and valid for the year and month, or 0 if specifying a datetime without a day.
hours: Option<i32>Optional. Hours of day in 24 hour format. Should be from 0 to 23, defaults to 0 (midnight). An API may choose to allow the value “24:00:00” for scenarios like business closing time.
minutes: Option<i32>Optional. Minutes of hour of day. Must be from 0 to 59, defaults to 0.
month: Option<i32>Optional. Month of year. Must be from 1 to 12, or 0 if specifying a datetime without a month.
nanos: Option<i32>Optional. Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999, defaults to 0.
seconds: Option<i32>Optional. Seconds of minutes of the time. Must normally be from 0 to 59, defaults to 0. An API may allow the value 60 if it allows leap-seconds.
time_zone: Option<TimeZone>Time zone.
utc_offset: Option<Duration>UTC offset. Must be whole seconds, between -18 hours and +18 hours. For example, a UTC offset of -4:00 would be represented as { seconds: -14400 }.
year: Option<i32>Optional. Year of date. Must be from 1 to 9999, or 0 if specifying a datetime without a year.
Implementations§
Source§impl DateTime
impl DateTime
Sourcepub fn set_or_clear_day<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_day<T>(self, v: Option<T>) -> Self
Sourcepub fn set_or_clear_hours<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_hours<T>(self, v: Option<T>) -> Self
Sourcepub fn set_minutes<T>(self, v: T) -> Self
pub fn set_minutes<T>(self, v: T) -> Self
Sourcepub fn set_or_clear_minutes<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_minutes<T>(self, v: Option<T>) -> Self
Sourcepub fn set_or_clear_month<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_month<T>(self, v: Option<T>) -> Self
Sourcepub fn set_or_clear_nanos<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_nanos<T>(self, v: Option<T>) -> Self
Sourcepub fn set_seconds<T>(self, v: T) -> Self
pub fn set_seconds<T>(self, v: T) -> Self
Sourcepub fn set_or_clear_seconds<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_seconds<T>(self, v: Option<T>) -> Self
Sourcepub fn set_time_zone<T>(self, v: T) -> Self
pub fn set_time_zone<T>(self, v: T) -> Self
Sourcepub fn set_or_clear_time_zone<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_time_zone<T>(self, v: Option<T>) -> Self
Sourcepub fn set_utc_offset<T>(self, v: T) -> Self
pub fn set_utc_offset<T>(self, v: T) -> Self
Sets the value of utc_offset.
§Example
use wkt::Duration;
let x = DateTime::new().set_utc_offset(Duration::default()/* use setters */);Sourcepub fn set_or_clear_utc_offset<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_utc_offset<T>(self, v: Option<T>) -> Self
Sets or clears the value of utc_offset.
§Example
use wkt::Duration;
let x = DateTime::new().set_or_clear_utc_offset(Some(Duration::default()/* use setters */));
let x = DateTime::new().set_or_clear_utc_offset(None::<Duration>);