Module twilight_mention::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::{timestamp::Timestamp, Mention};
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 representing a time to be formatted based on a client’s current local timezone and locale.
- Converting a
TimestampStyle
from a string slice failed.
Enums§
- Style modifier denoting how to display a timestamp.
- Type of
TimestampStyleConversionError
that occurred.