Struct chrono::naive::datetime::NaiveDateTime [] [src]

pub struct NaiveDateTime {
    // some fields omitted
}

ISO 8601 combined date and time without timezone.

Methods

impl NaiveDateTime

fn new(date: NaiveDate, time: NaiveTime) -> NaiveDateTime

Makes a new NaiveDateTime from date and time components. Equivalent to date.and_time(time) and many other helper constructors on NaiveDate.

fn from_timestamp(secs: i64, nsecs: u32) -> NaiveDateTime

Makes a new NaiveDateTime from the number of non-leap seconds since January 1, 1970 0:00:00 UTC (aka "UNIX timestamp") and the number of nanoseconds since the last whole non-leap second.

Panics on the out-of-range number of seconds and/or invalid nanosecond.

fn from_timestamp_opt(secs: i64, nsecs: u32) -> Option<NaiveDateTime>

Makes a new NaiveDateTime from the number of non-leap seconds since January 1, 1970 0:00:00 UTC (aka "UNIX timestamp") and the number of nanoseconds since the last whole non-leap second.

Returns None on the out-of-range number of seconds and/or invalid nanosecond.

fn from_num_seconds_from_unix_epoch(secs: i64, nsecs: u32) -> NaiveDateTime

Deprecated: Same to NaiveDateTime::from_timestamp.

fn from_num_seconds_from_unix_epoch_opt(secs: i64, nsecs: u32) -> Option<NaiveDateTime>

Deprecated: Same to NaiveDateTime::from_timestamp_opt.

fn parse_from_str(s: &str, fmt: &str) -> ParseResult<NaiveDateTime>

Parses a string with the specified format string and returns a new NaiveDateTime. See the format::strftime module on the supported escape sequences.

fn date(&self) -> NaiveDate

Retrieves a date component.

fn time(&self) -> NaiveTime

Retrieves a time component.

fn timestamp(&self) -> i64

Returns the number of non-leap seconds since January 1, 1970 0:00:00 UTC (aka "UNIX timestamp"). Note that this does not account for the timezone!

fn num_seconds_from_unix_epoch(&self) -> i64

Deprecated: Same to NaiveDateTime::timestamp.

fn checked_add(self, rhs: Duration) -> Option<NaiveDateTime>

Adds given Duration to the current date and time.

Returns None when it will result in overflow.

fn checked_sub(self, rhs: Duration) -> Option<NaiveDateTime>

Subtracts given Duration from the current date and time.

Returns None when it will result in overflow.

fn format_with_items<'a, I>(&self, items: I) -> DelayedFormat<I> where I: Iterator<Item=Item<'a>> + Clone

Formats the combined date and time with the specified formatting items.

fn format<'a>(&self, fmt: &'a str) -> DelayedFormat<StrftimeItems<'a>>

Formats the combined date and time with the specified format string. See the format::strftime module on the supported escape sequences.

Trait Implementations

impl Datelike for NaiveDateTime

fn year(&self) -> i32

fn month(&self) -> u32

fn month0(&self) -> u32

fn day(&self) -> u32

fn day0(&self) -> u32

fn ordinal(&self) -> u32

fn ordinal0(&self) -> u32

fn weekday(&self) -> Weekday

fn isoweekdate(&self) -> (i32, u32, Weekday)

fn with_year(&self, year: i32) -> Option<NaiveDateTime>

fn with_month(&self, month: u32) -> Option<NaiveDateTime>

fn with_month0(&self, month0: u32) -> Option<NaiveDateTime>

fn with_day(&self, day: u32) -> Option<NaiveDateTime>

fn with_day0(&self, day0: u32) -> Option<NaiveDateTime>

fn with_ordinal(&self, ordinal: u32) -> Option<NaiveDateTime>

fn with_ordinal0(&self, ordinal0: u32) -> Option<NaiveDateTime>

fn year_ce(&self) -> (bool, u32)

fn num_days_from_ce(&self) -> i32

impl Timelike for NaiveDateTime

fn hour(&self) -> u32

fn minute(&self) -> u32

fn second(&self) -> u32

fn nanosecond(&self) -> u32

fn with_hour(&self, hour: u32) -> Option<NaiveDateTime>

fn with_minute(&self, min: u32) -> Option<NaiveDateTime>

fn with_second(&self, sec: u32) -> Option<NaiveDateTime>

fn with_nanosecond(&self, nano: u32) -> Option<NaiveDateTime>

fn hour12(&self) -> (bool, u32)

fn num_seconds_from_midnight(&self) -> u32

impl Hash for NaiveDateTime

fn hash<H: Hasher>(&self, state: &mut H)

1.3.0fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher

impl Add<Duration> for NaiveDateTime

type Output = NaiveDateTime

fn add(self, rhs: Duration) -> NaiveDateTime

impl Sub<NaiveDateTime> for NaiveDateTime

type Output = Duration

fn sub(self, rhs: NaiveDateTime) -> Duration

impl Sub<Duration> for NaiveDateTime

type Output = NaiveDateTime

fn sub(self, rhs: Duration) -> NaiveDateTime

impl Debug for NaiveDateTime

fn fmt(&self, f: &mut Formatter) -> Result

impl Display for NaiveDateTime

fn fmt(&self, f: &mut Formatter) -> Result

impl FromStr for NaiveDateTime

type Err = ParseError

fn from_str(s: &str) -> ParseResult<NaiveDateTime>

Derived Implementations

impl Clone for NaiveDateTime

fn clone(&self) -> NaiveDateTime

1.0.0fn clone_from(&mut self, source: &Self)

impl Copy for NaiveDateTime

impl Ord for NaiveDateTime

fn cmp(&self, __arg_0: &NaiveDateTime) -> Ordering

impl PartialOrd for NaiveDateTime

fn partial_cmp(&self, __arg_0: &NaiveDateTime) -> Option<Ordering>

fn lt(&self, __arg_0: &NaiveDateTime) -> bool

fn le(&self, __arg_0: &NaiveDateTime) -> bool

fn gt(&self, __arg_0: &NaiveDateTime) -> bool

fn ge(&self, __arg_0: &NaiveDateTime) -> bool

impl Eq for NaiveDateTime

impl PartialEq for NaiveDateTime

fn eq(&self, __arg_0: &NaiveDateTime) -> bool

fn ne(&self, __arg_0: &NaiveDateTime) -> bool