Skip to content

Instantly share code, notes, and snippets.

@sag333ar
Created January 25, 2022 03:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sag333ar/e642dc9468a9707a839a1ab188881b9b to your computer and use it in GitHub Desktop.
Save sag333ar/e642dc9468a9707a839a1ab188881b9b to your computer and use it in GitHub Desktop.
Flutter - Seconds to Duration
// 4515 seconds to
// (60 * 60 * 1) + (15 * 60) + (15)
// 01:15:15
class Utilities {
static String formatTime(int seconds) {
return '${(Duration(seconds: seconds))}'
.split('.')[0]
.padLeft(8, '0');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment