0

I am working on this app and the project is running smoothly. A big part of the app is that it shows what time data was entered but I can't figure out to get the time out of the 24-hour format as shown in the screenshot.

Already looked at some solutions but I can't figure out how to implement them.

OMi Shah
  • 5,768
  • 3
  • 25
  • 34
remycodes
  • 3
  • 1
  • Does this answer your question? [How to convert time stamp string from 24 hr format to 12 hr format in dart?](https://stackoverflow.com/questions/59270847/how-to-convert-time-stamp-string-from-24-hr-format-to-12-hr-format-in-dart) – OMi Shah Aug 30 '23 at 04:31

1 Answers1

0

You can use DateFormat. For example:

final myDate = DateTime.now();
final formattedDate = DateFormat('MMMM dd, yyyy h:mm a').format(myDate);

Just change the format string that you pass as the first parameter to DateFormat to specify the format you want.

John Weidner
  • 2,055
  • 3
  • 18
  • 31