I want to change time 02:21:22 into 2 hours 21 minutes 22 seconds. How can I do this in flutter?
Asked
Active
Viewed 365 times
-1
-
3Does this answer your question? [How do I format a date with Dart?](https://stackoverflow.com/questions/16126579/how-do-i-format-a-date-with-dart) – Abbas Jafari Jun 10 '21 at 13:29
3 Answers
0
If it is a string you can use split method using delimeter : and then appending hours minutes and seconds to the result

Ashutosh Patole
- 926
- 1
- 7
- 23
0
You can try something like this.
var formatTime = myTime.replaceFirst(':',' Hours ').replaceFirst(':',' Minutes ') + ' Seconds';
print(formatTime); //02 Hours 21 Minutes 22 Seconds

Ibrahim Ali
- 2,083
- 2
- 15
- 36