Timestamp between Javascript and PHP

后端 未结 3 959
春和景丽
春和景丽 2020-12-15 04:43

Javascript:

I have object cell with something date

params.date = cell.getDate();
params.timestamp = cell.getDate().getTime() / 1000;
console.log(para         


        
3条回答
  •  粉色の甜心
    2020-12-15 05:20

    params.date = cell.getDate();
    

    Returns the DATE not the TIME.

    params.timestamp = cell.getDate().getTime() / 1000;
    

    is converting the date into a date+time - not reading the current time.

    But even if you get the timestamp in javascript, the output of PHP's date function will depend on what timezone it is in.

提交回复
热议问题