I have this date. 2014-11-15
The timestamp from PHP is 1415984400
How to get this timestamp in Javascript?
These are what i tried and the result.
Date.parse('2014-11-15').getTime()/1000
Error: Date.parse(...).getTime is not a function
Date.parse('2014-11-15')/1000
1416009600
new Date('2014-11-15').getTime() / 1000;
1416009600
None of them convert correctly.
Update: -----
<?php echo date('Y-m-d H:i:s', '1416009600'); ?>
Result:
2014-11-15 07:00:00
It looks like GMT problem. (Here is GMT+7) How to convert to unix timestamp in Javascript language?