在我的脚本标签中,var today以Sat Sep 07 2019 00:00:00 GMT+0530 (India Standard Time)日期格式显示,我想将此日期格式更改为yyyy-mm-dd格式。
我的代码:
<script>
$(document).ready(function() {
var date = new Date();
var today = new Date(date.getFullYear(), date.getMonth(), date.getDate());
console.log(today);
});
</script>
我正在尝试这样:
<script>
$(document).ready(function() {
var date = new Date();
var today = new Date(date.getFullYear(), date.getMonth(), date.getDate());
var newDate = "<?php echo date("Y-m-d", strtotime(today)); ?>";
console.log(newDate);
});
</script>
如何使用 更改日期格式strtotime()?
江户川乱折腾
ITMISS
RISEBY