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;
|
|
|
|
}
|
2024-10-07 12:45:45 +00:00
|
|
|
|
|
|
|
String formatYearDate(DateTime date) {
|
|
|
|
final DateFormat formatter = DateFormat('yyyy-MM-dd');
|
|
|
|
final String formatted = formatter.format(date);
|
|
|
|
return formatted;
|
|
|
|
}
|
2024-09-06 06:30:31 +00:00
|
|
|
}
|