timeHourFormatExpert static method
dynamic
timeHourFormatExpert(
{ - String? date,
- String? locale,
})
Implementation
static timeHourFormatExpert({String? date, String? locale}) {
try {
if (date?.isNotEmpty == true) {
var time = date?.split("+");
initializeDateFormatting("vi_VN");
var inputFormat =
DateFormat("yyyy-MM-dd'T'HH:mm:ss", locale ?? "vi_VN");
var inputDate = inputFormat.parse(time![0]);
var outputFormat = DateFormat('hh:mm a', locale ?? "vi_VN");
var outputDate = outputFormat.format(inputDate);
return outputDate.toUpperCase();
} else {
return "unknow";
}
} catch (e) {
return "format error";
}
}