Skip to content

Instantly share code, notes, and snippets.

@butlermatt
Created March 31, 2020 15:58
Show Gist options
  • Save butlermatt/7318e557994ec2778919284ed10bdf0e to your computer and use it in GitHub Desktop.
Save butlermatt/7318e557994ec2778919284ed10bdf0e to your computer and use it in GitHub Desktop.
Converts: hours; minutes; seconds, into milliseconds since midnight.
void main() {
print(fromTime(13, 30));
}
int fromTime(int hours, [int minutes = 0, int seconds = 0]) {
var tot = hours * 60 * 60;
tot += (minutes * 60);
tot += seconds;
return tot * 1000;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment