aewawc4453
aewawc4453

Reputation: 51

mysql DAYOFYEAR return different values (mysql bug with leap year)

Mysql server for

SELECT 
   DAYOFYEAR( FROM_UNIXTIME(unix_birthday, "%Y-%m-%d") ) as birthday_day,
   FROM_UNIXTIME(unix_birthday, "%Y-%m-%d") as usual_date, 
   unix_birthday
FROM workers

returns

unix_birthday | usual_date | day_number
     246      | 1980-09-02 | 336690000
     245      | 1990-09-02 | 652222800

Why the days are different (245 and 246)?

Upvotes: 1

Views: 56

Answers (1)

Shadow
Shadow

Reputation: 34243

1980 is a leap year, while 1990 is not.

Upvotes: 3

Related Questions