Daily Coding Challenge - Odd or Even Day

Tell us what’s happening:

The first and last tests are wrong. The value of milisecods in the first casa are from yesterday (even) and the last value in tests (tes n5) is the day the unix epoch started, January 1st 1970, so it shoul be an odd

Your code so far

from datetime import datetime


def odd_or_even_day(timestamp):
    
    seconds = timestamp / 1000
    
    date = datetime.fromtimestamp(seconds)
    formatted_time = date.strftime('%Y-%m-%d %H:%M:%S')
    day = int(formatted_time[8:10])

    if day % 2 != 0:
        return 'odd'
    
    elif day % 2 == 0:
        return 'even'

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36

Challenge Information:

Daily Coding Challenge - Odd or Even Day
https://www.freecodecamp.org/learn/daily-coding-challenge/2026-01-27

The tests are correct. You are getting local datetime, not UTC.