Re: how to get the local time

Re: how to get the local time

am 15.03.2010 21:10:10 von Ashley Sheridan

--=-0ihxVpmhZ3F77CYpfR8c
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

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



--=-0ihxVpmhZ3F77CYpfR8c--

how to get the local time

am 15.03.2010 21:10:31 von saeed ahmed

--00163646db3e19a8610481dc797e
Content-Type: text/plain; charset=UTF-8

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
-----

--00163646db3e19a8610481dc797e--

Re: how to get the local time

am 15.03.2010 22:16:33 von gary

You should be able to get the local time for Sweden by adding

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" wrote in message
news:b10025e1003151310j483caed1mef9ec76874a53f26@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





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

RE: how to get the local time

am 15.03.2010 22:56:10 von Daevid Vincent

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@gmail.com]
> Sent: Monday, March 15, 2010 1:11 PM
> To: php-general@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
> -----
>


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php