Menu

1 / 3

Two 1:30 AMs: report time without losing the actual instant

DEV Community: python·Wenlo·about 13 hours ago
#qFgiSAvm
#devtopython#devto#dev#local#print
Reading 0:00
15s threshold

Wenlo

Posted on Nov 16

AI-assisted

An event report can show 1:30 AM twice without containing a duplicate. During the autumn daylight-saving transition in New York, the local clock repeats an hour. Store the actual instants with offsets, then derive the local display and reporting date.

Run the example

All illustrative records are fictional. Save the following as timezone_report.py. The complete script was run in PythonIDE on iPhone with America/New_York time-zone data available; the screenshots show the actual source and output.

from datetime import datetime , timezone from collections import Counter from zoneinfo import ZoneInfo , ZoneInfoNotFoundError

# Fictional UTC events across a daylight-saving transition.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.