formatTimestampToTime static method

String formatTimestampToTime(
  1. int? timestamp
)

Implementation

static String formatTimestampToTime(int? timestamp) {
  if (timestamp == null) {
    return "N/A"; // Return "N/A" if the timestamp is null
  }
  DateTime date = DateTime.fromMillisecondsSinceEpoch(timestamp);
  // Format the date to the desired format
  final formatter = DateFormat('hh:mm a'); // 12-hour format
  return formatter.format(date);
}