【问题标题】:php js working with event start date and end datephp js处理事件开始日期和结束日期
【发布时间】:2016-07-02 12:41:41
【问题描述】:

我正在编写与事件一起使用的脚本,事件开始于 2016 年 12 月 2 日 11:20,结束于 2016 年 1 月 4 日 8:20 当我到达结束日期时,我需要触发我尝试使用 js 的操作

if (t.getFullYear()===ey && t.getMonth()===em && t.getMonth()===ed) {
    //the event still happening check the time
}

if (t.getFullYear()<ey && t.getMonth()<em && t.getMonth()<ed) {
    //the event is still not ended
}

if (t.getFullYear()>ey && t.getMonth()>em && t.getMonth()>ed) {
    //the event is dead 
}

ey 代表年份 和 em 一个月 和 ed 像这样 ey=2016,em=07,ed=05 我正在考虑这个 enddate-startdate=timestamp 来触发操作我如何使用 php 来做到这一点?

【问题讨论】:

  • 我不太明白你的问题...你想知道如何从 js 调用 php?或者如何将 js 翻译成 php?作为旁注,您需要小心根据客户端日期控制服务器中的内容,客户端日期将根据客户端物理位置(PST、EST 等)而有所不同。如果你已经在你的服务器上处理了这个,或者你可以在你的事件调用中有这个时间差异,那么你很好。

标签: javascript php date


【解决方案1】:

我想我是从不同的角度看待问题,只需要 5 秒的 ajax 请求和服务器端 php 检查 如果(今天-结束日期

【讨论】:

    猜你喜欢
    • 2012-08-19
    • 2022-01-23
    • 1970-01-01
    • 1970-01-01
    • 2021-11-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-10-05
    相关资源
    最近更新 更多