Unix Timestamp in Dart
Look up the current epoch time and convert between Unix seconds and UTC dates in Dart.
Get the current timestamp
void main() {
print((DateTime.now().millisecondsSinceEpoch / 1000).floor());
}Timestamp to date
void main() {
final date = DateTime.fromMillisecondsSinceEpoch(1700000000 * 1000, isUtc: true);
print(date.toIso8601String());
}Date to timestamp
void main() {
final date = DateTime.parse("2023-11-14T22:13:20Z");
print((date.millisecondsSinceEpoch / 1000).floor());
}Open 1700000000 in the converter
Current Unix time
Seconds—
Milliseconds—
- UTC
- —
- My time zone
- —
Free to use. Your input stays in this browser.
How to use it
- Copy the current-time example into your Dart environment to read Unix seconds.
- Run the second example to display 1700000000 as a UTC date.
- Run the last example to convert that date back into seconds.
DateTime exposes milliseconds and microseconds since the epoch. Set isUtc: true when constructing a UTC value to avoid a local-time display.