我遇到了这个问题。我想用jquery
window.newdatevalue = '<?php echo date("Y-m-d") ?>';// this date is dynamic
var newdate = window.newdatevalue;
console.log(newdate); // when i print this it give me right result -2017-02-06
var finaldate = "<?php echo date('d/M/y',strtotime('"+newdate+"'))?>";
console.log(finaldate); // but when i print this it give me wrong result 01/Jan/70
任何人都可以帮助我,我做错了吗
答案 0 :(得分:0)
可以试试这个。它可能会对你有帮助。
window.newdatevalue = '<?php echo date("d-m-Y", strtotime(date("Y-m-d"))); ?>'
console.log(window.newdatevalue);