duanfenhui5511 2017-01-24 06:12
浏览 13
已采纳

Excel工作表的PHP日期问题

I am trying to convert an old office excel sheet document data into PHP web based app for searching and other data analysis. Stuck in how to fields called start_date & end_date. This tells me that if project is active or not. Data saved in below format. It compares both dates and return the project status by comparing with current date.

Start_Date  End Date  Status
1-Jan-16    31-Dec-16  Active or not

I tried with PHP date("Y-m-d") function but month is an issue.

  • 写回答

1条回答 默认 最新

  • duanjiaopi8218 2017-01-24 06:57
    关注

    You can use the strtotime() function on your excel derived dates and then convert it to a usable DateTime value using date() like so:

    $time_before = strtotime('1-Jan-16');
    $date_before = date('Y-m-d', $time_before); // 2016-01-01
    
    $time_after  = strtotime('31-Dec-16');
    $date_after  = date('Y-m-d', $time_after); // 2016-12-31
    

    Then compare the two dates against each other.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

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