【问题标题】:How can i check the input date is with in last 90 days or not in php我如何检查输入日期是否在过去 90 天内在 php 中
【发布时间】:2015-05-18 06:10:00
【问题描述】:

我正在使用 jquery 日期选择器,从中我得到了格式为 yyyy-mm-dd 的日期。 我需要知道的是,我想检查输入日期是不是从今天开始的过去 90 天。

$( "#dt_affected" ).datepicker({
        changeMonth: true,
        changeYear: true,
});

我在 php 中将其读取为 $posted["dt_affected"]= $this->input->post("dt_affected", true); 我得到了结果2011-06-15 提前致谢

【问题讨论】:

  • 你的代码在哪里?你标记了 jQuery & JS,为什么?
  • 对于日期选择器,我使用这个 $("#dt_salary_affected").datepicker({ changeMonth: true, changeYear: true, });我在我的 php $posted["dt_salary_affected"] = $this->input->post("dt_salary_affected", true);我得到的结果是 2011-06-15。

标签: php


【解决方案1】:

如果你想在服务器端检查日期,你可以使用下面的代码

echo date ( $format, strtotime ( '-90 day' . $date ) ); 

【讨论】:

  • 我想根据我从日期选择器获得的日期进行检查。如果该日期是从今天起的最后 90 天内,那么我会做些别的事情。
  • 不客气。如果我的回答解决了您的问题,请接受我的回答。
猜你喜欢
  • 1970-01-01
  • 2011-12-26
  • 1970-01-01
  • 1970-01-01
  • 2016-12-03
  • 1970-01-01
  • 1970-01-01
  • 2012-01-08
  • 1970-01-01
相关资源
最近更新 更多