...

View Full Version : DATE_FORMAT returning NULL



tripwater
09-01-2006, 05:49 PM
Not sure why but I have an int field that hold a timestamp int and I know for a fact that my fields does not hold a null but when I run this query


select DATE_FORMAT(StartSec, '%Y-%c-%e') as Day from dates limit 5;


I get 5 records with NULL in them. What am I doing wrong?


Thank you for any help with this.

tripwater
09-01-2006, 06:01 PM
Nevermind, I answered my own question with



select DATE_FORMAT(FROM_UNIXTIME(StartSec), '%Y-%c-%e') as Day from dates limit 5;

I needed to convert the int to a string first.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum