|
|
|
| Title : |
Timezone Handling - A PHP function that wraps several DateTime methods to simplify timezone handling. |
| Categories : |
PHP, Date Time |
 Alix Axel |
| Date : |
Apr 28th 2009 |
| Grade : |
5 of 5 (graded 1 times) |
| Viewed : |
1422 |
| File : |
No file for this code example. |
| Images : |
No Images for this code example. |
|
| Search : |
More code by Alix Axel |
|
| Action : |
Grade This Code Example
|
|
| Tools : |
My Examples List |
|
|
|
|
|
|
|
|
|
|
Like this code?
Show the author your appreciation.
|
| |
| <?php
function Timestamp($format = 'U', $time = 'now', $timezone = null)
{
$result = date_create($time);
if (is_a($result, 'DateTime') === true)
{
if (is_null($timezone) === false)
{
date_timezone_set($result, timezone_open($timezone));
}
return date_format($result, $format);
}
return false;
}
?> | |
Usage:
| <?php
Timestamp('d/m/Y H:i:s', '20090401020304');
Timestamp('d/m/Y H:i:s', '20090401020304', 'Europe/Lisbon'); // 01/04/2009 02:03:04
Timestamp('d/m/Y H:i:s', '20090401020304', 'Europe/Madrid'); // 01/04/2009 03:03:04
?> | | |
|
| Validator - A PHP class that can can be used for validating Email IDs and Dates Categories : PHP, PHP Classes, Data Validation, Email, Date Time | | | Calendar, Kalender, date, time, day, month, year Categories : PHP, Date Time, Calendar | | | List people whose birthdays fall on the current Day and Month
Categories : Databases, Date Time, MySQL, PHP | | | In Mysql, the 'datetime' data type is used to store date that looks like '2007-10-16 16:26:30'. we are going to design a function called mysqldate() that takes a mysql date and output format as input and outputs a well formated date. Categories : PHP, Date Time, Databases, MySQL | | | Calendar using Date function Categories : HTML and PHP, PHP, Date Time, Calendar | | | A Timing Class Categories : PHP, PHP Classes, Date Time | | | Data Retrieve from Mysql using AJAX with PHP Categories : PHP, AJAX, Date Time, Databases, MySQL | | | Open and Close your website in fixed times . Categories : PHP, PHP Classes, Cron, Date Time | | | Monthly and Daily Upcoming Events calendar. Categories : Date Time, PostgreSQL, PHP, Calendar, Databases | | | Local Time clock and Server time usign PHP and JavaScript Categories : PHP, Java Script, Date Time, Beginner Guides | | | Calendar class on the same page , suitable for reservation
Categories : PHP, Calendar, Date Time | | | Script loading time Categories : PHP, Beginner Guides, Date Time | | | CALENDAR - easy calendar-navigation with PHP Categories : PHP, Date Time, HTML and PHP, Calendar | | | Simple graphic clock/watch generation using gd library. Categories : Graphics, Date Time, PHP | | | Count how many weeks in the month have a specified day, such as Mon, Tue, etc. Var avail - number of days - first day name of the month, occurrences of Sun, occurrences of Mon, etc. Allows you to calculate number of working hours exclude Holidays. Categories : Calendar, Date Time, PHP, Databases, MySQL | |
| |
| |
|