0

I'm retrieving a DateTime from MySql DataBase, but it comes on a different format than the countdown allows.

mysql has this date format: 2015-07-07 00:00:00

countdown only admmits: YYYY/MM/DD , MM/DD/YYYY , YYYY/MM/DD hh:mm:ss , MM/DD/YYYY hh:mm:ss

productos.js

$('#clock').countdown("2015/10/10", function(event) {
   var totalHours = event.offset.totalDays * 24 + event.offset.hours;
   $(this).html(event.strftime(totalHours + ' hr %M min %S sec'));
});

index.php

<div id="clock" name="clock"></div>
    
<h5 id="fecha"> <?php echo $producto['fecha_creacion'];?> </h5>

How can I solve this problem?

Community
  • 1
  • 1
  • possible duplicate of [How can I convert string to datetime with format specification in JavaScript?](http://stackoverflow.com/questions/476105/how-can-i-convert-string-to-datetime-with-format-specification-in-javascript) – Adam Link Jul 07 '15 at 00:33
  • why didn't you try to reformat the date in php? – Cerlin Jul 07 '15 at 10:40

1 Answers1

0

Finally, I used moment.js, because php date had 5hour difference and I needed an accurate one for the Countdown.