dtdt0454 2015-09-06 18:10
浏览 69
已采纳

Jquery倒计时插件,来自Mysql数据库的日期

I'm trying to modifie the JS script so I can get the date from a database instead of typing it manually. I don't really know how to get right format on the date. The plugin only use days, hours, minutes, seconds.

Is there someone that can help me?

Jquery countdown plugin

Original:

$(function () {
var austDay = new Date();
austDay = new Date(austDay.getFullYear() + 1, 1 - 1, 2);
$('#defaultCountdown').countdown({until: austDay});
$('#year').text(austDay.getFullYear());
});

</script>

Modified:

<?php $waa = '1441894898' ?>

<script>

$(function () {
var austDay = <?php echo json_encode($waa); ?>;
$('#defaultCountdown').countdown({until: austDay});
});
</script>
  • 写回答

2条回答 默认 最新

  • dpgbh20688 2015-09-06 18:22
    关注

    The plugin don't only use years, months, etc..., but a javascript Date (reference here) instance. So if your $waa variable is the date from what you want to count down, and it is in milliseconds, the var austDay = new Date(<?php echo $waa; ?>); code should work.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 已知许多点位,想通过高斯分布来随机选择固定数量的点位怎么改
  • ¥15 怎么生成确定数目的泊松点过程
  • ¥15 layui数据表格多次重载的数据覆盖问题
  • ¥15 python点云生成mesh精度不够怎么办
  • ¥15 QT C++ 鼠标键盘通信
  • ¥15 改进Yolov8时添加的注意力模块在task.py里检测不到
  • ¥50 高维数据处理方法求指导
  • ¥100 数字取证课程 关于FAT文件系统的操作
  • ¥15 如何使用js实现打印时每页设置统一的标题
  • ¥15 安装TIA PortalV15.1报错