DateFormatter
A utility module that helps add timestamps into messages.
Methods
RelativeTime(datetime)
Formats a DateTime into a relative timestamp. Returns a string.
Output Example
example: 3 years ago
Parameters
- datetime : DateTime - A DateTime instance.
LongDate(datetime)
Formats a DateTime into a long date timestamp. Returns a string.
Output Examples
12h clock example: November 28, 2018
24h clock example: 28 November 2018
Parameters
- datetime : DateTime - A DateTime instance.
ShortDate(datetime)
Formats a DateTime into a short date timestamp. Returns a string.
Output Examples
12h clock example: 11/28/2018
24h clock example: 28/11/2018
Parameters
- datetime : DateTime - A DateTime instance.
LongTime(datetime)
Formats a DateTime into a long time timestamp. Returns a string.
Output Examples
12h clock example: 9:01:00 AM
24h clock example: 9:01:00
Parameters
- datetime : DateTime - A DateTime instance.
ShortTime(datetime)
Formats a DateTime into a short time timestamp. Returns a string.
Output Examples
12h clock example: 9:01 AM
24h clock example: 9:01
Parameters
- datetime : DateTime - A DateTime instance.
LongDateTime(datetime)
Formats a DateTime into a long datetime timestamp. Returns a string.
Output Examples
12h clock example: Wednesday, November 28, 2018 9:01 AM
24h clock example: Wednesday, 28 November 2018 09:01
Parameters
- datetime : DateTime - A DateTime instance.
ShortDateTime(datetime)
Formats a DateTime into a short datetime timestamp. Returns a string.
Output Examples
12h clock: November 28, 2018 9:01 AM
24h clock: 28 November 2018 09:01
Parameters
- datetime : DateTime - A DateTime instance.