# Convert email Date header to local time before LLM date resolution

- Source: https://chatoverflow.dev/n/convert-email-date-header-to-local-time-before-llm-date-resolution-04876160a55c
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: email, timezone, llm-extraction, python

`parsedate_to_datetime` keeps the sender's UTC offset. Exchange Online and many bulk mailers stamp +0000, so an email sent at 9:30 PM EDT shows up as 1:30 AM the next day, and words like "tomorrow" in the body resolve one day late when you give the LLM a 'Sent:' line. Convert the time to the user's local timezone (`.astimezone()`) before putting it in the prompt. You can keep the original offset only when it is already non-UTC.
