Login   Register  
PHP Classes
elePHPant
Icontem

File: sample.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Tom Schaefer  >  QDate  >  sample.php  >  Download  
File: sample.php
Role: Example script
Content type: text/plain
Description: Samples showing how to use the fluent interface design.
Class: QDate
Manipulate dates in different formats
Author: By
Last change: adding examples
Date: 2008-06-01 03:48
Size: 1,935 bytes
 

Contents

Class file image Download
<?php

include_once 'QDate.class.php';

print 
"<pre>";

$date QGermanDate::getInstance()
        ->
setDate()
        ->
format(9)
        ->
getDate();

echo 
$date."\n";

$date3 QGermanDate::getInstance()
        ->
setDate()
        ->
getDayName();

echo 
$date3."\n";

$date3a QGermanDate::getInstance()
        ->
setDate()
        ->
getMonthName();

echo 
$date3a."\n";

$date3a QIsoDate::getInstance()
        ->
setDate()
        ->
getMonthName();

echo 
$date3a."\n";

$date3b QGermanDate::getInstance()
        ->
setDate()
        ->
isLeapYear();

echo 
$date3b."\n";

$date3c QGermanDate::getInstance()
        ->
setDate()
        ->
daysInMonth();

echo 
$date3c."\n";

$date3c QGermanDate::getInstance()
        ->
setDate()
        ->
getWeekDayNum();

echo 
$date3c."\n";

$date3c QGermanDate::getInstance()
        ->
setDate()
        ->
getQuarter();

echo 
$date3c."\n";

$date3c QGermanDate::getInstance()
        ->
setDate()
        ->
getYearDay();

echo 
$date3c."\n";

$date2 QIsoDate::getInstance()
        ->
setDate()
        ->
getWeek();
echo 
$date2 ."\n";

$date3 QIsoDate::getInstance()
        ->
setDate()
        ->
getIsoDate();
echo 
$date3 ."\n";


$datediff QIsoDate::getInstance()
            ->
getDiffInDays(strtotime('2008-05-28'), time());
echo 
$datediff."\n";

$datediff QIsoDate::getInstance()->daysUntil('2009-06-01');
echo 
$datediff;

$loc QGermanDate::getInstance()
        ->
setDate('11.01.2009 10:01:00')
        ->
getWeekDayName();
echo 
$loc;

$loc QGermanDate::getInstance()
        ->
setDate('11.01.2009 10:01:00')
        ->
parseDate();
print_r($loc);

print_r(QGermanDate::getAll());
print_r(QDateFormat::getInstance()->getAll());

$patterns = new QDatePattern("nld_nld");
print_r($patterns->parseDate("d/m/Y","01/02/2008")); // british date pattern
print_r($patterns);

$patterns = new QDatePattern("deu_deu");
print_r($patterns->parseDate("d/m/Y","01/02/2008"));
print_r($patterns->changeTo("j. F Y H:i","Y-m-d H:i:s","2008-04-29 09:44:32"));

?>