dongzhang7157 2010-07-25 16:21
浏览 55

帮助MySQL Unix时间戳查询

I am trying to create a custom MySQL for use with the Expression Engine CMS. The purpose of the query is to display events that are happening today or in the future.

The problem is that the EE field type that allows you to put in the date and converts it into a unix timestamp. If I pick the 26th July it puts in the date value "25th July 23:00".

As you see from my query below it almost works but I need to add 24 hours onto the values that are used in the conditional part of the statement. I want events that occur on the day "for example today 25th July" to be displayed up until 23:00 hours that day then be removed. I almost have it I am just stuck on how to add 24 hours to the conditional.

           SELECT t.entry_id, 
                       t.title, 
                       t.url_title, 
                       d.field_id_13 AS event_lineup, 
                       d.field_id_14 AS event_details, 
                       d.field_id_15 AS event_day, 
                       d.field_id_16 AS event_flyer_front, 
                       d.field_id_17 AS event_flyer_back, 
                       d.field_id_18 AS event_facebook, 
                       d.field_id_12 AS event_date 
             FROM `exp_weblog_titles` AS t 
NATURAL JOIN `exp_weblog_data` AS d 
           WHERE d.weblog_id = 5 
               AND CAST(d.field_id_12 AS UNSIGNED) >= (unix_timestamp(Now())) 
      ORDER BY d.field_id_12 ASC
  • 写回答

1条回答 默认 最新

  • doudou0111 2010-07-25 16:23
    关注

    What I think might be happening is your timestamps get adjusted for the time zone, and that adjustment is configured differently in the CMS and on the server.

    评论

报告相同问题?

悬赏问题

  • ¥60 许可证msc licensing软件报错显示已有相同版本软件,但是下一步显示无法读取日志目录。
  • ¥15 Attention is all you need 的代码运行
  • ¥15 一个服务器已经有一个系统了如果用usb再装一个系统,原来的系统会被覆盖掉吗
  • ¥15 使用esm_msa1_t12_100M_UR50S蛋白质语言模型进行零样本预测时,终端显示出了sequence handled的进度条,但是并不出结果就自动终止回到命令提示行了是怎么回事:
  • ¥15 前置放大电路与功率放大电路相连放大倍数出现问题
  • ¥30 关于<main>标签页面跳转的问题
  • ¥80 部署运行web自动化项目
  • ¥15 腾讯云如何建立同一个项目中物模型之间的联系
  • ¥30 VMware 云桌面水印如何添加
  • ¥15 用ns3仿真出5G核心网网元