getTime method

String getTime(
  1. int? timestamp
)

Implementation

String getTime(int? timestamp) {
  DateTime now = DateTime.now();
  final DateTime date1 = timestamp == null
      ? now
      : DateTime.fromMillisecondsSinceEpoch(timestamp);
  String formattedDate = DateFormat('hh:mm a').format(date1); //yyyy-MM-dd –
  // var fm1 = DateFormat('hh:mm a').parse(formattedDate, true);
  return formattedDate;
}