dateFormat static method

String? dateFormat(
  1. dynamic tanggal, {
  2. String format = 'dd MMMM yyyy',
  3. String locale = 'id',
  4. Duration? addDuration,
})

Implementation

static String? dateFormat(dynamic tanggal,
    {String format = 'dd MMMM yyyy',
    String locale = 'id',
    Duration? addDuration}) {
  String? hasil;

  DateTime? date = toDateTime(tanggal);
  if (date != null) {
    if (addDuration != null) {
      date = date.add(addDuration);
    }
    hasil = DateFormat(format, locale).format(date).toString();
  }
  return hasil;
}