Skip to main content

Class TimestampTag

Represents a class used to make timestamps in messages. see https://discord.com/developers/docs/reference#message-formatting-timestamp-styles.

Assembly: Discord.Net.Core.dll​
View Source​
Declaration
public class TimestampTag

Properties​

Style​

Gets or sets the style of the timestamp tag.

View Source​
Declaration
public TimestampTagStyles Style { get; set; }

Time​

Gets or sets the time for this timestamp tag.

View Source​
Declaration
public DateTime Time { get; set; }

Methods​

ToString()​

Converts the current timestamp tag to the string representation supported by discord. <p> If the Discord.TimestampTag.Time is null then the default 0 will be used. </p>

View Source​
Declaration
public override string ToString()
Returns​

System.String: A string that is compatible in a discord message, ex: <pre>&lt;t:1625944201:f&gt;</pre>### FromDateTime(DateTime, TimestampTagStyles) Creates a new timestamp tag with the specified datetime object.

View Source​
Declaration
public static TimestampTag FromDateTime(DateTime time, TimestampTagStyles style = TimestampTagStyles.ShortDateTime)
Returns​

Discord.TimestampTag: The newly create timestamp tag.

Parameters​
TypeNameDescription
System.DateTimetimeThe time of this timestamp tag.
Discord.TimestampTagStylesstyleThe style for this timestamp tag.