getFormattedDate function

String getFormattedDate(
  1. DateTime now
)

Implementation

String getFormattedDate(DateTime now) {
  final year = now.year;
  final month = now.month.toString().padLeft(2, '0');
  final day = now.day.toString().padLeft(2, '0');
  final hour = now.hour.toString().padLeft(2, '0');
  final minute = now.minute.toString().padLeft(2, '0');
  final second = now.second.toString().padLeft(2, '0');
  return '$year-$month-${day}_$hour-$minute-$second';
}