String ISODate format to DateTime Format

380 views
Skip to first unread message

Denis Ramdan

unread,
Oct 1, 2018, 3:00:04 AM10/1/18
to Flutter Dev
i have String ISODate '2018-09-30T11:00:30.757Z'. my question is how to convert that String to DateTime Format, like '2018/09/30 07:00 PM' ?

Sam Dzirasa

unread,
Oct 1, 2018, 11:27:02 AM10/1/18
to denisr...@gmail.com, Flutter Dev
I had similar problems a while back You have to ignore the fractional part.  

Try this:

DateTime getDartDateFromNetUTC(String netUtcDate) {
  var dateParts = netUtcDate.split(".");
  var actualDate = DateTime.parse(dateParts[0] + "Z");
  return actualDate;
}



On Mon, Oct 1, 2018 at 3:00 AM Denis Ramdan <denisr...@gmail.com> wrote:
i have String ISODate '2018-09-30T11:00:30.757Z'. my question is how to convert that String to DateTime Format, like '2018/09/30 07:00 PM' ?

--
You received this message because you are subscribed to the Google Groups "Flutter Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages