How to convert datetime to database's format

  • Posts: 217
  • Thank you received: 4
4 years 11 months ago #305840

-- HikaShop version -- : 4.0.3

Hello,

I am trying to connect Hikashop (mysql) to 3rd party SaaS software to be able to generate coupons automatically.

Only problem I have is that I would need to convert date time (for example DD/MM/YYYY HH:MM) to format that is stored in Hikashop database: for example: 1455449220

Please, what is the formula? What logic is there?


Thank you very much in advance,
Filip

Please Log in or Create an account to join the conversation.

  • Posts: 81378
  • Thank you received: 13037
  • MODERATOR
4 years 11 months ago #305841

Hi,

It is a unix timestamp:
www.unixtimestamp.com/
In PHP, you have many functions to handle dates and unix timestamps:
www.php.net/manual/en/function.strtotime.php
www.php.net/manual/en/function.strftime.php

In MySQL, you also have functions to convert them directly in the conditions of the MySQL queries or for the results:
stackoverflow.com/questions/11133760/mys...me-to-unix-timestamp

Please Log in or Create an account to join the conversation.

  • Posts: 217
  • Thank you received: 4
4 years 11 months ago #305855

Thank you very much! That helped a lot!

Please Log in or Create an account to join the conversation.

Time to create page: 0.050 seconds
Powered by Kunena Forum