Skip to content
Foxipa
Code Completion 4 Challenges

Complete the dates and times code

Practice date arithmetic, ISO parsing, aware UTC values, and named timezone conversion.

Intermediate ~8 min read

Challenge 1

Calculate a deadline exactly fourteen days after start.

python Your answer
from datetime import date, timedelta

start = date(2026, 10, 12)
deadline = 
print(deadline.isoformat())

Press Ctrl⌘Enter to check your answer

Challenge 2

Parse the ISO datetime string, preserving the +00:00 offset.

python Your answer
from datetime import datetime

value = 
print(value.isoformat())
print(value.utcoffset())

Press Ctrl⌘Enter to check your answer

Challenge 3

Create an aware datetime whose timezone is explicitly UTC.

python Your answer
from datetime import datetime, timezone

meeting = datetime(2026, 10, 12, 9, 30, tzinfo=)
print(meeting.utcoffset())

Press Ctrl⌘Enter to check your answer

Challenge 4

Convert the UTC instant to Paris local time, without merely replacing timezone metadata.

python Your answer
from datetime import datetime, timezone
from zoneinfo import ZoneInfo

instant = datetime(2026, 7, 15, 12, 0, tzinfo=timezone.utc)
local = instant.astimezone()
print(local.strftime("%H:%M %z"))

Press Ctrl⌘Enter to check your answer