Hi friends ,
I am new to php . Can anyone help to get list of dates between 2 dates.
Thanks in advance
gowni
List of Date between two dates
Moderator: General Moderators
I prefer using the highlevel time-functions of php even if it take a bit longer. They are very flexible.
e.g.
take a look at the manual pages of
strtotime()
getdate()
date()
mktime()
e.g.
Code: Select all
<?php
$tsStart = strtotime("15 December 2003");
$tsEnd = strtotime("+1 week", $tsStart);
$dateStart = getdate($tsStart);
do
{
$tsCurrent = mktime(
$dateStart['hours'], $dateStart['minutes'], $dateStart['seconds'],
$dateStart['mon'], $dateStart['mday'], $dateStart['year']
);
echo date('D M j Y', $tsCurrent), "\n";
$dateStart['mday'] += 1; // mktime takes care of day-of-month values that are out-of-bound
}while($tsCurrent < $tsEnd);
?>strtotime()
getdate()
date()
mktime()