RE: [PHP] Dates and different time zones

2007-04-10 Thread Niklas Karlsson
Thanks for good answers.
Okay, so I should set the default time zone to central GMT time, and then
save GMT offset for every user. This sounds realistic, because I don't think
that I need to correct the time for users that doesn't login.

So, if I now have the GMT offset for every user, how do I display the right
date? Can someone please show some phpcode? I would be very grateful if
someone could do that.

>>>Satyam wrote:
>>> Store all of your dates as GMT. Perform all date based calculations 
>>> around GMT also, and then offset the values for localised display only.
>>>
>>> This way you only need to store the GMT offsets for each user, i.e. 
>>> GMT+1 or GMT-8 when it comes to displaying the dates to them. The 
>>> trick is to use a constant base date for all data, and only being the 
>>> user timezones into play when needed.
>>>
>> Actually, I find that it is better not to bother storing anything for 
>> the user at all.  At the first chance, get some JavaScript to read the 
>> local time of the client machine and send it back to the server, either 
>> with the login data, using some AJAX or along with any link the user 
>> might click on the welcome screen, for example, the language choice.  
>> Then use the offset from his local time to the server time for every 
>> time information, substract it from any time information you read from 
>> them, add it to anything you send them.  This works whether the user is 
>> registered or not, whether he/she travels or remains in the same time 
>> zone and spares you the trouble of keeping your IP to country to 
>> timezone table updated.  It assumes that the user updates the time zone 
>> on his/her machine and if he doesn't it means she doesn't care, so why 
>> should you. (some travellers prefer to keep their portable machines set 
>> to their home-base time zone)

>Of cause the major fault with this is that it can only display the CURRENT 
>time offset. You *ALSO* need the users Daylight Saving Zone as well. This
>has 
>been giving us great fun since the winter dates and times need a different 
>offset to the summer ones. Something that simplistic browser time offset
>does 
>not supply. :(

>The only way to get this working properly at present is to get the user to
>set 
>their time/daylight settings in their profile, and then you can provide the

>correct offset for all days on a calendar. Remember that for users WITH a 
>daylight saving offset, one day each year has 23 hours and one 25 hours ;)

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



[PHP] Dates and different time zones

2007-04-10 Thread Niklas Karlsson
Hello,

 

I am creating an international site that is going to get used in both
American and Europe. And I wonder how to handle the different time zones,
because I want the date and time to be correct after the place your using
the application.

 

I now have the date_default_timezone_set() to "Europe/Stockholm", and all
dates that is saved into the database is timestamp with time zone (using
PostgreSQL).

 

So a wonder who to handle different time zones? Have any of your experience
of this?

 

Cheers

Niklas Karlsson 



SV: [PHP] Need sql-editor

2007-01-31 Thread Niklas Karlsson
Niklas Karlsson wrote:
> Hello everyone
> 
>  
> 
> I need a good sql-editor where I can write sqlcode. The problem is that I
> don't have rights to list tables, functions and so on. Now I use EMS Sql
> Manger 2005, and if I want to write and execute sqlcode I need access to
the
> system tables, and I don't have it on this database.
> 
>  
> 
> So, I need a sqlmanger that I cant write and execute sqlcode and don't
have
> the access, and where a can view the result nicely.

Chris wrote:
> Best to ask on a more appropriate list of forum - like one that 
> discusses your chosen database whatever that may be (ms-sql?).

I use Postgresql. I have find a application that's fill my requirement. 
QueryIT
http://www.dbtools.com.br/EN/queryit/

And next time, I am going to think about the subject.
Thanks

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



[PHP] Need sql-editor

2007-01-31 Thread Niklas Karlsson
Hello everyone

 

I need a good sql-editor where I can write sqlcode. The problem is that I
don't have rights to list tables, functions and so on. Now I use EMS Sql
Manger 2005, and if I want to write and execute sqlcode I need access to the
system tables, and I don't have it on this database.

 

So, I need a sqlmanger that I cant write and execute sqlcode and don't have
the access, and where a can view the result nicely.

 

Hope you understand, my English isn't on top :-)

 

// Niklas