Re: Date & time

From: Date: Wed, 30 Jan 2002 01:03:02 +0000
Subject: Re: Date & time
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-82631@lists.php.net to get a copy of this message
To correct the time, try this: <? $time = time(); echo "time = ".date("Y/m/d H:i:s",$time)."<br>"; $time = $time + (7*60*60); echo "adjusted time = ".date("Y/m/d H:i:s",$time)."<br>"; ?> -- Gaylen gfraley5@earthlink.net Home http://www.gaylenandmargie.com/ PHP KISGB v3.22 Guest Book http://www.gaylenandmargie.com/phpwebsite/ "Torkil Johnsen" <torkil.johnsen@stud.hibo.no> wrote in message news:INELIHOCKHFJNOPCOBKCKEKACPAA.torkil.johnsen@stud.hibo.no... > Hello... > > I have a field in my mysql database containing date&time on the format > YYYY-MM-DD HH:MM:SS (24-hour format) > > Now. I want to output this as follows: DD.MM.YY at HH:MM:SS > Currently I do this by this function: > > function convert_datetime($in){ > $return = substr($in,8,2) . "." . substr($in,5,2) . "." . substr($in,2,2) . > " at " . substr($in,11,8); > return $return; > } > > Is there a better way? Either with mysql or php? > Now. Another problem. Since my webserver is in the states, and I live in > Norway, I get a 7 hour time difference. > > So when I do date("Y-m-d H:i:s") I get a time that is 7 hours wrong. > Any idea as to how I can correct this to be 7 hours later (that is: 12 in > server time is really 19 where I live) in an easy way? > > THanks in advance, > Torkil >

« previous php.general (#82631) next »