PHP Classes
elePHPant
Icontem

File: day_iterator.example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Michal Vrchota  >  Day Iterator  >  day_iterator.example.php  >  Download  
File: day_iterator.example.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Day Iterator
Iterate the over the days of a range of dates
Author: By
Last change:
Date: 8 years ago
Size: 558 bytes
 

Contents

Class file image Download
<?php

// test file for class dayIterator

require_once("day_iterator.php");

$from = MkTime(0, 0, 0, 7, 11, 1986); // I was born in friday
$to = MkTime(0, 0, 0, 7, 20, 1986); // I am still alive :)

$dayIterator = new DayIterator($from, $to);

echo
"List of days from ".Date("j.n.Y", $dayIterator->getFrom())." - ".Date("j.n.Y", $dayIterator->getTo());
echo
"<br />";

foreach(
$dayIterator as $day => $date)
{
    echo
"$day. ".Date("j.n.Y D", $date)."<br />";
}

echo
"Total number of days days: ".($dayIterator->getDiffDays() + 1);

?>