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.

    评论

报告相同问题?

悬赏问题

  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。