19 lines
573 B
Dart
19 lines
573 B
Dart
|
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;
|
||
|
}
|
||
|
}
|