【问题标题】:Codeigniter : Validating - date not to be longer than two dateCodeigniter:验证 - 日期不超过两个日期
【发布时间】:2017-08-24 14:24:35
【问题描述】:

我需要解决这个问题: 1)我的项目中有两个日期输入 2) 我需要注册(第一次)日期不超过比赛日期(第二次)。

<div class="form-group">
                        <label for="date"><?php echo $lang['date_tournament']; ?></label>
                        <input type="text" class="form-control datepicker" name="date_tournament" required> 

【问题讨论】:

标签: codeigniter


【解决方案1】:
<?php $first = strtotime($registrationdate);
$second = strtotime($tournamentdate);
$datediff = $first  - $second;

if(floor($datediff / (60 * 60 * 24))<2){
echo 'valid';
} ?>

【讨论】:

猜你喜欢
  • 2015-04-19
  • 2013-08-12
  • 1970-01-01
  • 2017-06-27
  • 1970-01-01
  • 1970-01-01
  • 2017-12-06
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多