Skip to content

Instantly share code, notes, and snippets.

@kwalrath
Last active July 15, 2019 21:55
Show Gist options
  • Save kwalrath/39a574ebf877375b7a11905b135da3df to your computer and use it in GitHub Desktop.
Save kwalrath/39a574ebf877375b7a11905b135da3df to your computer and use it in GitHub Desktop.
Convert timestamp
// Say the timestamp in the Travis log looks like this:
//
// travis_time:end:22889f10:start=1559926540498807523,finish=1559926542012374871,duration=1513567348
//
// This program prints the time in local and UTC time zones.
main() {
int build = (1559926542012374871.0/1e6).toInt();
var buildDateTime = DateTime.fromMillisecondsSinceEpoch(build);
print('Local time: $buildDateTime');
print('UTC time: ${buildDateTime.toUtc()}');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment