Flutter & Dart Tools

Dart DateTime Converter

Prepare a DateTime expression from a known instant rather than guessing timestamp units. This converter accepts ISO 8601 text with an explicit Z or numeric offset, or an integer Unix timestamp in seconds or milliseconds. It reports Unix milliseconds, whole Unix seconds, UTC text and the browser-local representation alongside the generated Dart expression. It does not execute arbitrary Dart code. For DateTime-to-epoch work, enter the ISO representation of the value or its known timestamp. Select units explicitly rather than inferring them from how many digits you see.

Your workspace

Runs locally in your browser

Result

Your input is processed locally in your browser unless explicitly stated otherwise. Inputs are not saved by this tool.

How to use this tool

Choose ISO, seconds or milliseconds. Enter a timestamp or ISO date with an explicit zone, choose UTC/local output and convert.

Example

Input

2026-01-01T00:00:00Z

Output

DateTime.parse("2026-01-01T00:00:00Z").toUtc()

What does this tool do?

DateTime.parse understands ISO text, while DateTime.fromMillisecondsSinceEpoch expects milliseconds. For second-based input this tool multiplies by 1000 before generating the constructor. The constructor explicitly uses isUtc: true, then the selected .toUtc() or .toLocal() call expresses the intended representation. The instant stays the same when you change its display timezone.

Common mistakes and limitations

Unqualified dates such as 2026-01-01T12:00:00 are ambiguous across machines and are rejected here. Use Z for UTC or a numeric offset such as +05:30. The local text shown below the code uses this browser’s timezone; Dart .toLocal() uses the runtime device’s timezone, which may differ. This tool does not model named timezone rules or daylight-saving transitions for arbitrary regions.

Frequently asked questions

Can I paste arbitrary DateTime Dart code?

No. Enter ISO text or a numeric timestamp; the tool generates code but never evaluates code.

Related tools