How to fine dates in between dates. I have start_date 2008-10-25 and end_date 2008-11-10. I want dates given between dates. How to find this. Help me. ?
[code=php]if (($check_date > $start_date) && ($check_date < $end_date)) { echo 'OK'; }[/code]
[code=php]<?php $start_date = '2008-10-25'; $end_date = '2008-11-10'; $days = round((strtotime($end_date) - strtotime($start_date)) / 86400); $start_parts = explode('-', $start_date); for ($i=0 ; $i<=$days ; $i++) { echo date('Y-m-d', mktime(0, 0, 0, $start_parts[1], $start_parts[2]+$i, $start_parts[0])) . '<br />'; } ?>[/code]
[CODE]2008-10-25 2008-10-26 2008-10-27 2008-10-28 2008-10-29 2008-10-30 2008-10-31 2008-11-01 2008-11-02 2008-11-03 2008-11-04 2008-11-05 2008-11-06 2008-11-07 2008-11-08 2008-11-09 2008-11-10[/CODE]
[code=php]$start_date = '2008-10-25'; $end_date = '2008-11-10'; $start_ts = strtotime($start_date); $end_ts = strtotime($end_date); $new_ts = $start_ts; while (($new_ts = strtotime('+1 day', $new_ts)) < $end_ts) { echo date('Y-m-d', $new_ts) . '<br />'; }[/code]
[CODE]2008-10-26 2008-10-27 2008-10-28 2008-10-29 2008-10-30 2008-10-31 2008-11-01 2008-11-02 2008-11-03 2008-11-04 2008-11-05 2008-11-06 2008-11-07 2008-11-08 2008-11-09[/CODE]
Help @jsaravananj spread the word by sharing this article on Twitter...