Trait ExtOffsetDateTime

Source
pub trait ExtOffsetDateTime {
    // Required methods
    fn is_same_minute(&self, b: &OffsetDateTime) -> bool;
    fn reset_minute(&self) -> OffsetDateTime;
    fn milli_timestamp(&self) -> i64;
    fn to_display_string(&self, offset_hours: i8) -> String;
    fn to_chinese_string(&self) -> String;
    fn from_milliseconds(
        timestamp: u64,
        offset_hours: i8,
    ) -> Result<OffsetDateTime>;
    fn from_seconds(timestamp: u64, offset_hours: i8) -> Result<OffsetDateTime>;
    fn from_date_time(
        date: &str,
        time: &str,
        milli: u64,
        offset_hours: i8,
    ) -> Result<OffsetDateTime>;
    fn from_simple(dt: &str, offset_hours: i8) -> Result<OffsetDateTime>;
    fn convert_to_dot_date(input: &str) -> Result<String>;

    // Provided method
    fn now_with_offset(offset_hours: i8) -> OffsetDateTime { ... }
}

Required Methods§

Source

fn is_same_minute(&self, b: &OffsetDateTime) -> bool

Check if two timestamps are in the same minute

Source

fn reset_minute(&self) -> OffsetDateTime

Reset seconds and subseconds to zero

Source

fn milli_timestamp(&self) -> i64

Get timestamp in milliseconds

Source

fn to_display_string(&self, offset_hours: i8) -> String

Format datetime to display string with timezone

Source

fn to_chinese_string(&self) -> String

Format datetime to Chinese style string with timezone

Source

fn from_milliseconds(timestamp: u64, offset_hours: i8) -> Result<OffsetDateTime>

Parse timestamp in milliseconds with timezone offset (hours from UTC)

Source

fn from_seconds(timestamp: u64, offset_hours: i8) -> Result<OffsetDateTime>

Parse timestamp in seconds with timezone offset (hours from UTC)

Source

fn from_date_time( date: &str, time: &str, milli: u64, offset_hours: i8, ) -> Result<OffsetDateTime>

Parse datetime from date string, time string and milliseconds with timezone

Source

fn from_simple(dt: &str, offset_hours: i8) -> Result<OffsetDateTime>

Parse datetime from simple format string (YYYYMMDD_HHMM) with timezone

Source

fn convert_to_dot_date(input: &str) -> Result<String>

Convert date format from YYYYMMDD to YYYY.MM.DD

Provided Methods§

Source

fn now_with_offset(offset_hours: i8) -> OffsetDateTime

Get current time with specified timezone offset (hours from UTC)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§