1

I've searched but could not find the solution for my case.

One date is recorded at MYSQL, for example it returns: 2013-10-18 15:42:06 (which format is this ?)

So I need to get the current date (including hours, minutes and seconds).

Then, subtract the MYSQL date - CURRENT date.

The result, i'll set as an jQuery countdown.

Thanks!

Aditya Vikas Devarapalli
  • 3,186
  • 2
  • 36
  • 54
Tiago
  • 144
  • 10
  • Regarding your format question: "YYYY-MM-DD HH:MM:SS". See [MariaDB Knowledgebase](https://mariadb.com/kb/en/datetime/) or [Wikipedia](http://en.wikipedia.org/wiki/ISO_8601) – nietonfir Oct 18 '13 at 19:34

1 Answers1

2

This should work:

$seconds_remaining = strtotime('2013-10-18 15:42:06') - time();

Although if you happen to know what timezone the MySQL time corresponds to, then you should append that to the argument passed to strtotime(), e.g., '2013-10-18 15:42:06 GMT'

r3mainer
  • 23,981
  • 3
  • 51
  • 88