Storing events as unix timestamps instead of datetime fields

Hi there, I want to use dhtmlxScheduler in an application that stores events as unix timestamps as follows:

timestart bigint(10)
timeduration bigint(10)

Changing the fields this to a datetime field is not an option as the application is huge and I would have to hack into it’s core code. Also, there is no time_end field (just timeduration).

Please could you let me know what my options are here? I need to cater for timezones etc as well.

Hello,

You can do the following:

  • convert those timestamps to dates on selects from database
  • pass as is and convert everything to date objects on client-side

Kind regards,
Ilya

Hi Ilya,

Thanks for your reply.

So to convert those timestamps to dates on selects from database, do I do something like the following?

SELECT FROM_UNIXTIME(timestart) AS start_time, FROM_UNIXTIME(timestart + timeduration) AS end_time, event_description FROM mytable;

I’m note sure how to “pass as is and convert everything to date objects on client-side”. Could you give me an example?

Much appreciated.

Thanks,
Barry