formatDate function

String formatDate(
  1. DateTime date, [
  2. TimestampStyle style = TimestampStyle.none
])

Formats the date into a date string timestamp.

Implementation

String formatDate(DateTime date, [TimestampStyle style = TimestampStyle.none]) =>
    '<t:${date.millisecondsSinceEpoch ~/ 1000}${style == TimestampStyle.none ? '' : ':${style.style}'}>';