note 83351 added to function.mktime

From: Date: Thu, 22 May 2008 00:34:38 +0000
Subject: note 83351 added to function.mktime
Groups: php.notes 
Request: Send a blank email to php-notes+get-139597@lists.php.net to get a copy of this message
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. Wait we need an output. To get the output for two timezone we need also two output script. 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 ---- Server IP: 69.147.83.197 Probable Submitter: 121.97.236.237 ---- Manual Page -- http://www.php.net/manual/en/function.mktime.php Edit -- https://master.php.net/note/edit/83351 Del: integrated -- https://master.php.net/note/delete/83351/integrated Del: useless -- https://master.php.net/note/delete/83351/useless Del: bad code -- https://master.php.net/note/delete/83351/bad+code Del: spam -- https://master.php.net/note/delete/83351/spam Del: non-english -- https://master.php.net/note/delete/83351/non-english Del: in docs -- https://master.php.net/note/delete/83351/in+docs Del: other reasons-- https://master.php.net/note/delete/83351 Reject -- https://master.php.net/note/reject/83351 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#139597) next »