KonectarEvents/lib/utils/dateformater.dart

19 lines
573 B
Dart
Raw Permalink Normal View History

2024-09-06 06:30:31 +00:00
import 'package:intl/intl.dart';
class CustomDateFormatter {
DateTime convertStringToDate(String datestring) {
print("Date string : $datestring");
List<String> datearray = datestring.split('/');
DateTime outputDate = DateTime(int.parse(datearray[2]),
int.parse(datearray[0]), int.parse(datearray[1]));
print("Output date : $outputDate");
return outputDate;
}
String formatDate() {
final DateFormat formatter = DateFormat('yyyy-MM-dd hh:mm');
final String formatted = formatter.format(DateTime.now());
return formatted;
}
}