PHP Classes

File: date_country_example.php

Recommend this page to a friend!
  Classes of Sarawut Lorvijit   The Country Date   date_country_example.php   Download  
File: date_country_example.php
Role: Example script
Content type: text/plain
Description: Example
Class: The Country Date
Get date or time for a given time zone
Author: By
Last change: Edit to prevent error.
Date: 4 years ago
Size: 2,367 bytes
 

Contents

Class file image Download
<?php
/*
TheCountryDate Class Example
By Sarawut Lorvijit
Created : 26/04/2009
Modified : 01/05/2009
Please send e-mail to me (osarawut@yahoo.com) for your interest in this.
*/
//----------------------------------------------------------------------------------------------------//
//inclusion
require("base.php");
require(
"date_country.php");
//----------------------------------------------------------------------------------------------------//
$name = "TheCountryDate Class";
$title = $name." Example";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php echo $title; ?></title>
</head>
<body>
<div>
<?php
echo $title;
//----------------------------------------------------------------------------------------------------//
//declaration
$bln_uploaded = true; //true : uploaded to the host

$obj_date = new date_country($bln_uploaded);

//----------------------------------------------------------------------------------------------------//
//host date
$host_timezone = $obj_date->get_timezone();
$host_timezone = !($host_timezone)?"[Unknow]":$host_timezone; //PHP >= 5.1.0 return a string
echo '<br /><br />The host timezone is '.$host_timezone.', on <br />';
echo
$obj_date->get_date();

//----------------------------------------------------------------------------------------------------//
//your country date
echo "\n";
echo
'<br /><br />Our country timezone is '.$obj_date->get_local_timezone().', Diff hour = '.$obj_date->get_local_diff_hour().', on <br /><font color="#009900">';
echo
$obj_date->get_local_date().'</font>';

$int_local_week_day = $obj_date->get_local_week_day();
$int_local_hour = $obj_date->get_local_hour();

echo
'<br />Today is '.$obj_date->get_week_day_compre($int_local_week_day);
echo
', Hour : '.$int_local_hour;
if(
$int_local_week_day==0&&$int_local_hour>=0){ //0 : Sunday, 0 : midnight
   
echo '<br /><br />The Sunday is ours.';
}else{
    echo
'<br /><br />It is not our day.';
}
echo
' Our day is '.$obj_date->get_week_day_compre(0).'.';
//----------------------------------------------------------------------------------------------------//

echo '<br /><br /><br />'.$name.' v. '.$obj_date->version();
?>
</div>
</body>
</html>