KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Timestamp to datetime conversion #1243

Open soulcage opened this topic on on Jan 3, 2020 - 2 comments

soulcage commented on Jan 3, 2020

hi, i am trying to use the "mysql" example with my own database. my database has a date row formated as timestamp (unixtime) but the example setup function where it uses TimeBucket needs the datetime format.

i tried

->query("SELECT FROM_UNIXTIME(date) FROM MyTableName")

with no success...

how can i convert from timestamp to datetime so the TimeBucket process can use the right format? any help is welcome...

soulcage commented on Jan 4, 2020

...it seems to generate the chart but with unixtime as the months and it throws errors on the TimeBucket.php in line 131 for every query...

so the .view.php also has to be converted to datetime...but how?

i testet the "from_unixtime()" sql function with my database and it works as expected, it gives me datetime in format yyyy-mm-dd h:i:s why does timebucket throws that error?

KoolReport commented on Jan 4, 2020

You try this:

SELECT FROM_UNIXTIME(date) as standardDate FROM MyTableName

The issue could be from the column name returned from query. Let me know if it works.

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
help needed

None