Re: Date & time
| From: | Richard Baskett | Date: | Wed, 30 Jan 2002 00:55:43 +0000 |
| Subject: | Re: Date & time | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-82629@lists.php.net to get a copy of this message | ||
Ok first I will answer you last question.. use
gmdate (http://www.php.net/manual/en/function.gmdate.php)
instead of
date (http://www.php.net/manual/en/function.date.php)
And then for your MySQL output use
SELECT DATE_FORMAT(fieldName, '%d.%m.%y at %H:%i:%s') AS newDate
You can view documentation at
http://www.mysql.com/doc/D/a/Date_and_time_functions.html
Cheers!
Rick
"When a man won't listen to his conscience, it's usually because he doesn't
want advice from a total stranger." - Lindsey Stewart
> From: "Torkil Johnsen" <torkil.johnsen@stud.hibo.no>
> Date: Wed, 30 Jan 2002 01:29:37 +0100
> To: <php-general@lists.php.net>
> Subject: [PHP] Date & time
>
> 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
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>