Skip to content

Instantly share code, notes, and snippets.

@Noisytoot
Last active June 8, 2018 18:19
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 Noisytoot/27f4fe8d2cd11b04ddaa910da7053f77 to your computer and use it in GitHub Desktop.
Save Noisytoot/27f4fe8d2cd11b04ddaa910da7053f77 to your computer and use it in GitHub Desktop.
Time
void main() {
DateTime time = new DateTime.now();
print("Time: $time");
print("Time Zone: ${time.timeZoneName}");
print("UTC Time: ${time.toUtc()}");
print("Year: ${time.year}");
print("Month: ${time.month}");
print("Day: ${time.day}");
print("Hour: ${time.hour}");
print("Minute: ${time.minute}");
print("Second: ${time.second}");
print("Millisecond: ${time.millisecond}");
print("Microsecond: ${time.microsecond}");
print("Milliseconds since epoch: ${time.millisecondsSinceEpoch}");
print("Microseconds since epoch: ${time.microsecondsSinceEpoch}");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment