From: saeed ahmed on
hi friends,

I'm trying to set local time in my php script. I was trying date and time
function but its always show the server time not local time. i need help on
this problem. how can i set the local time. i need sweden time zone
-----
Regards
Saeed Ahmed
http://saeed05.wordpress.com
-----
From: Ashley Sheridan on
On Tue, 2010-03-16 at 02:10 +0600, saeed ahmed wrote:

> hi friends,
>
> I'm trying to set local time in my php script. I was trying date and time
> function but its always show the server time not local time. i need help on
> this problem. how can i set the local time. i need sweden time zone
> -----
> Regards
> Saeed Ahmed
> http://saeed05.wordpress.com
> -----


Do you mean local time as in the clients computer time? If so, as far as
I know you can't get that with PHP. What you would have to do is grab it
with JavaScript or something, and then pass that across to your server
script.

Thanks,
Ash
http://www.ashleysheridan.co.uk


From: "Gary" on
You should be able to get the local time for Sweden by adding

<?php
date_default_timezone_set('Stockholm/Sweden');
echo date('l F jS, o');?>

However, I dont know about getting the local time of someone visiting from a
different time zone.

gary


"saeed ahmed" <saeed.sas(a)gmail.com> wrote in message
news:b10025e1003151310j483caed1mef9ec76874a53f26(a)mail.gmail.com...
> hi friends,
>
> I'm trying to set local time in my php script. I was trying date and time
> function but its always show the server time not local time. i need help
> on
> this problem. how can i set the local time. i need sweden time zone
> -----
> Regards
> Saeed Ahmed
> http://saeed05.wordpress.com
> -----
>
>
>
> __________ Information from ESET Smart Security, version of virus
> signature database 4946 (20100315) __________
>
> The message was checked by ESET Smart Security.
>
> http://www.eset.com
>
>



__________ Information from ESET Smart Security, version of virus signature database 4946 (20100315) __________

The message was checked by ESET Smart Security.

http://www.eset.com




From: "Daevid Vincent" on
You either have to use JS on the client side.

Or you store the user's timezone as a preference in their profile and
compute using that by setting a TZ variable.

Normally you would store all data in mySQL in UTC and then convert on the
fly as mentioned above for each user.

> -----Original Message-----
> From: saeed ahmed [mailto:saeed.sas(a)gmail.com]
> Sent: Monday, March 15, 2010 1:11 PM
> To: php-general(a)lists.php.net
> Subject: [PHP] how to get the local time
>
> hi friends,
>
> I'm trying to set local time in my php script. I was trying
> date and time
> function but its always show the server time not local time.
> i need help on
> this problem. how can i set the local time. i need sweden time zone
> -----
> Regards
> Saeed Ahmed
> http://saeed05.wordpress.com
> -----
>