Reputation: 73
How to convert RequireDate(String) to DateTime ?
Upvotes: 0
Views: 1707
Reputation: 5756
You could use intl
for this. Based on the format of RequiredDate
, design a DateFormat
and call parse
on the input.
import 'package:intl/intl.dart';
void main() {
print(DateFormat("dd/MMM/y").parse("31/Oct/2022"));
}
You could try this code on https://dartpad.dev as well, I tinkered it on it to design the solution.
Upvotes: 2
Reputation: 173
Use a datetime parse DateTime RequireDate;
RequireDate: DateTime.parse(RequireDate),
Upvotes: 0