Skip to main content

Module timestamp

Module timestamp 

Source
Expand description

Timestamps with the ability to be formatted in clients based on the client’s local timezone and locale.

Included is the TimestampStyle denoting how to format a timestamp and the Timestamp itself, containing an optional style and a Unix timestamp.

§Examples

Format a Timestamp into a valid Discord Markdown markdown via its implementation of Mention:

use twilight_mention::{Mention, timestamp::Timestamp};

let timestamp = Timestamp::new(1624047064, None);

println!("This action was performed at {}", timestamp.mention());

TimestampStyle implements Display, which allows you to easily print the display modifier of a style:

use twilight_mention::timestamp::TimestampStyle;

println!("The modifier is '{}'", TimestampStyle::RelativeTime);

Structs§

Timestamp
Timestamp representing a time to be formatted based on a client’s current local timezone and locale.
TimestampStyleConversionError
Converting a TimestampStyle from a string slice failed.

Enums§

TimestampStyle
Style modifier denoting how to display a timestamp.
TimestampStyleConversionErrorType
Type of TimestampStyleConversionError that occurred.