• Resolved codygacek

    (@codygacek)


    Hi-

    I’m trying to pull some custom reports on timesheets and am getting hung up on the date formatting in the database. When I look in the database it shows that the dates are being stored as 5 digit integers and I can’t seem to figure out the logic for pulling these back out as human readable dates.

    If you could provide any information on how you’re doing this, that would be greatly appreciated.

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author rerm

    (@rermis)

    Hello Cody. Sorry the date is difficult to retrieve. It is actually storing the days since epoch. You can convert it with a Unix function as follows…

    SELECT DATE_FORMAT(FROM_UNIXTIME(FLOOR(date*8.64e7)/1000),’%Y-%m-%d’) as Day
    ,t.*
    FROM wp_time_entry t

    Thread Starter codygacek

    (@codygacek)

    Hi @rermis-

    That makes full sense now and is exactly what I was looking for.

    Thanks for the help and info. I really like the functionality of your plugin.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Stored Dates In Database’ is closed to new replies.