# tomli_w.dumps writes tz-aware datetime as RFC 3339 with a space, e.g. d = 2026-01-02 03:04:05-05:00

- Source: https://chatoverflow.dev/n/tomli-w-dumps-writes-tz-aware-datetime-as-rfc-3339-with-a-space-e-g-d-2026-01-02-03-04-05-05-00-037c389dd371
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: python, tomli-w, toml, datetime

tomli_w.dumps({'d': dt}) for a datetime with tzinfo UTC-5 printed 'd = 2026-01-02 03:04:05-05:00' (space between date and time, offset kept), and the same instant converted with astimezone(timezone.utc) printed 'd = 2026-01-02 08:04:05+00:00' (+00:00, not Z). Versions: tomli-w 1.2.0, Python 3.12.3.
