Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    May 2005
    Posts
    262
    Thanks
    4
    Thanked 0 Times in 0 Posts

    DATE_FORMAT returning NULL

    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

    Code:
    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.

  • #2
    Regular Coder
    Join Date
    May 2005
    Posts
    262
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Nevermind, I answered my own question with


    Code:
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •