pub trait ExtOffsetDateTime {
Show 19 methods
// 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, OffsetDateTimeError>;
fn from_seconds(
timestamp: u64,
offset_hours: i8,
) -> Result<OffsetDateTime, OffsetDateTimeError>;
fn from_date_time(
date: &str,
time: &str,
milli: u64,
offset_hours: i8,
) -> Result<OffsetDateTime, OffsetDateTimeError>;
fn from_simple(
dt: &str,
offset_hours: i8,
) -> Result<OffsetDateTime, OffsetDateTimeError>;
fn convert_to_dot_date(input: &str) -> Result<String, OffsetDateTimeError>;
fn replace_time_with_seconds(
&self,
seconds: i64,
) -> Result<OffsetDateTime, OffsetDateTimeError>;
fn align_to(
&self,
interval: i64,
) -> Result<OffsetDateTime, OffsetDateTimeError>;
fn next_day(&self) -> OffsetDateTime;
fn next_hour(&self) -> OffsetDateTime;
fn next_minute(&self) -> OffsetDateTime;
fn next_second(&self) -> OffsetDateTime;
fn to_hour_seconds(&self) -> i64;
fn to_minute_seconds(&self) -> i64;
// Provided method
fn now_with_offset(offset_hours: i8) -> OffsetDateTime { ... }
}Required Methods§
Sourcefn is_same_minute(&self, b: &OffsetDateTime) -> bool
fn is_same_minute(&self, b: &OffsetDateTime) -> bool
Check if two timestamps are in the same minute
Sourcefn reset_minute(&self) -> OffsetDateTime
fn reset_minute(&self) -> OffsetDateTime
Reset seconds and subseconds to zero
Sourcefn milli_timestamp(&self) -> i64
fn milli_timestamp(&self) -> i64
Get timestamp in milliseconds
Sourcefn to_display_string(&self, offset_hours: i8) -> String
fn to_display_string(&self, offset_hours: i8) -> String
Format datetime to display string with timezone
Sourcefn to_chinese_string(&self) -> String
fn to_chinese_string(&self) -> String
Format datetime to Chinese style string with timezone
Sourcefn from_milliseconds(
timestamp: u64,
offset_hours: i8,
) -> Result<OffsetDateTime, OffsetDateTimeError>
fn from_milliseconds( timestamp: u64, offset_hours: i8, ) -> Result<OffsetDateTime, OffsetDateTimeError>
Parse timestamp in milliseconds with timezone offset (hours from UTC)
Sourcefn from_seconds(
timestamp: u64,
offset_hours: i8,
) -> Result<OffsetDateTime, OffsetDateTimeError>
fn from_seconds( timestamp: u64, offset_hours: i8, ) -> Result<OffsetDateTime, OffsetDateTimeError>
Parse timestamp in seconds with timezone offset (hours from UTC)
Sourcefn from_date_time(
date: &str,
time: &str,
milli: u64,
offset_hours: i8,
) -> Result<OffsetDateTime, OffsetDateTimeError>
fn from_date_time( date: &str, time: &str, milli: u64, offset_hours: i8, ) -> Result<OffsetDateTime, OffsetDateTimeError>
Parse datetime from date string, time string and milliseconds with timezone
Sourcefn from_simple(
dt: &str,
offset_hours: i8,
) -> Result<OffsetDateTime, OffsetDateTimeError>
fn from_simple( dt: &str, offset_hours: i8, ) -> Result<OffsetDateTime, OffsetDateTimeError>
Parse datetime from simple format string (YYYYMMDD_HHMM) with timezone
Sourcefn convert_to_dot_date(input: &str) -> Result<String, OffsetDateTimeError>
fn convert_to_dot_date(input: &str) -> Result<String, OffsetDateTimeError>
Convert date format from YYYYMMDD to YYYY.MM.DD
Sourcefn replace_time_with_seconds(
&self,
seconds: i64,
) -> Result<OffsetDateTime, OffsetDateTimeError>
fn replace_time_with_seconds( &self, seconds: i64, ) -> Result<OffsetDateTime, OffsetDateTimeError>
Sourcefn align_to(&self, interval: i64) -> Result<OffsetDateTime, OffsetDateTimeError>
fn align_to(&self, interval: i64) -> Result<OffsetDateTime, OffsetDateTimeError>
Sourcefn next_day(&self) -> OffsetDateTime
fn next_day(&self) -> OffsetDateTime
Get next day at the same time
Sourcefn next_hour(&self) -> OffsetDateTime
fn next_hour(&self) -> OffsetDateTime
Get next hour at the same minute and second
Sourcefn next_minute(&self) -> OffsetDateTime
fn next_minute(&self) -> OffsetDateTime
Get next minute at the same second
Sourcefn next_second(&self) -> OffsetDateTime
fn next_second(&self) -> OffsetDateTime
Get next second
Sourcefn to_hour_seconds(&self) -> i64
fn to_hour_seconds(&self) -> i64
Convert time part to seconds, ignoring minutes and seconds
§Returns
Total seconds of hours (hours * 3600)
Note: Returns i64 to support time differences and negative values
Sourcefn to_minute_seconds(&self) -> i64
fn to_minute_seconds(&self) -> i64
Convert time part to seconds, ignoring seconds
§Returns
Total seconds of hours and minutes (hours * 3600 + minutes * 60)
Note: Returns i64 to support time differences and negative values
Provided Methods§
Sourcefn now_with_offset(offset_hours: i8) -> OffsetDateTime
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.