formatTimestamp function

String formatTimestamp(
  1. DateTime dateTime
)

Helper function to format a DateTime object to human readable format i.e. 2025-06-05T12:33:32 will be readable as 5th June 2025, 12:33 PM

dateTime - DateTime object

Returns a human readable string in the format of 5th June 2025, 12:33 PM

Implementation

String formatTimestamp(DateTime dateTime) {
  return DateFormat('dd MMM yyyy, hh:mm:ssss a').format(dateTime);
}