note 83351 deleted from function.mktime by derick
| From: | derick@php.net | Date: | Sat, 26 Jul 2008 10:07:29 +0000 |
| Subject: | note 83351 deleted from function.mktime by derick | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-142780@lists.php.net to get a copy of this message | ||
Note Submitter: jhuntech09 at yahoo dot com
----
This script is for creating servertime with auto detect server timezone.
<?php
$month = date(m); //* Get Current Month //
$day = date(j); //* Get Current Day //
$year = date(Y); //* Get Current Year //
$hour = date(G); //* Get Current Hour (24 Hours Format) //
$min = date(i); //* Get Current Minutes //
$sec = date(s); //* Get Current Seconds //
$gmt = date(O); //* Get Current Timezone //
$servertime = date("D \\- M j\\, Y \\- g:i A", mktime($hour+$gmt, $minutes, $sec, $month,
$day, $year, 0));
print $servertime;
?>
If you want to input a multiple timezone. just copy the "$gmt = date(O). Then add increments to
"$gmt" and replace the "date(O)" to any timezone you want.
For example:
I need only 2 timezone, Standard GMT and Pacific Timezone.
I will remove "$gmt" and replace it with "$gmt1" and "$gmt2".
Then for "$gmt1" I will replace the "date(O)" with 0, so my Timezone1 is equal
to Standard GMT.
Then for "$gmt2" I will replace the "date(O)" with -8, so my Timezone2 is equal
to Pacific Timezone.
To get the output for two timezone we need also two output script.
<?php
echo date("D \\- M j\\, Y \\- g:i A", mktime($hour+$gmt1, $minutes, $sec, $month, $day,
$year, 0));
echo date("D \\- M j\\, Y \\- g:i A", mktime($hour+$gmt2, $minutes, $sec, $month, $day,
$year, 0));
?>
Enjoy scripting,
-JhunTech09