duanliaoyu8419 2016-05-26 06:57
浏览 38

PHP。 如何比较多个日期列并回显下一个即将到来的日期的行。

I have a database of expiry dates. In this database I have 4 columns specifically for dates. I want to be able to compare all the 4 dates (in the 4 columns) for each of the rows and echo the database ordered by those expiring soon on top followed in that order. To be more clear : the 4 dates in each row should be compared to the ones in other rows and there is no need for any logic here. even if one date in one of the row is earlier then any other date in the other row then that row with the former date should be echoed first. My question is can I use PhP conditional statements to compare dates. If not how else can i approach this problem ?

  • 写回答

2条回答 默认 最新

  • dongyou7472 2016-05-26 07:02
    关注

    Use time stamps!

    You could fetch them in sql by

    UNIX_TIMESTAMP(yourdate)
    

    In your select statement

    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度