Home > other >  How to get time in hours,minutes,seconds from this format 0:02:54.000000 in flutter?
How to get time in hours,minutes,seconds from this format 0:02:54.000000 in flutter?

Time:09-02

I have genrated time in this format 0:02:54.000000

Now I want to display that time in hours = 0, Minutes = 02, Seconds = 54 from above time. How do I get it.

CodePudding user response:

You can try this:

String input = '0:02:54.000000';
final split = input.split(RegExp('[:.]'));
String hours = split[0];
String minutes = split[1];
String seconds = split[2];
  • Related