flogiston

Blog

Finding the average date in MySQL

· admin · MySQL

Today I had to find the average of some dates in MySQL. Took me some googling, but finally found a "bug" report here.

Conclusion: use something like
SELECT FROM_UNIXTIME(AVG(UNIX_TIMESTAMP(dateColumnName))) AS averageDate FROM tablename

2 comments

student ·

Thanks you very much ..
I have try that work and running well..

Hristo ·

Naah,

it does not work for date of birth when there are people born before 1970-01-01...