fromTimeStamptoDateTime static method

String fromTimeStamptoDateTime(
  1. double timeStamp
)

Implementation

static String fromTimeStamptoDateTime(double timeStamp) {
  // Convert timestamp to milliseconds
  int millisecondsSinceEpoch = (timeStamp * 1000).toInt();

  // Create DateTime object
  DateTime parsedDate =
      DateTime.fromMillisecondsSinceEpoch(millisecondsSinceEpoch);
  DateFormat format = DateFormat("d MMM yyyy");
  String formattedDate = format.format(parsedDate);
  String formattedTime = DateFormat.jm().format(parsedDate);
  return "$formattedDate, $formattedTime";
}