Then somewhere there has to be a cross reference between name and
timezone info.  I'm sorry I'm not running Apache here and don't have
access to the same info that you're using, but I'd try digging into
those config files and any database tables you can find that seem to
relate to it.  I'm sorry I can't be more help, but it's gotta be in
there somewhere.

Maybe someone else can give you a better idea.

I'm re-posting this to PHP General in case someone has any addition
info.  Sorry for the long-winded response that didn't really help. Hah.
I didn't even consider the whole alphabetical thing, I should have
noticed.

Good luck!

-TG

> -----Original Message-----
> From: Venelin Arnaudov [mailto:[EMAIL PROTECTED] 
> Sent: Monday, November 22, 2004 11:24 AM
> To: Gryffyn, Trevor
> Subject: Re: [PHP] Timezones
> 
> 
> Hi Trevor,
> 
> I am using Eclipse with a PHP plugin to modify my PHP system. 
> Actually 
> this system is based on the Source Forge but the guy that 
> made all the 
> modifications is not available any more and I am trying to 
> understand it 
> and perform some changes.
> 
> The user.timezones field is modified by the user himself by selecting 
> the appropriate TZ from the list attached in my previous mail. I am 
> looking for a PHP function or script that would give me the offset of 
> each TZ in respect of GMT. As input parameter it should have 
> the string 
> TZ_name and as result the time (in hours, minutes or seconds).
> 
> Using Excel does not help because in the list I have 466 
> entries for 24 
> whole hours and some half hours. I cannot apply any logic to 
> this list 
> because it is sorted alphabetically. But my Apache/PHP knows 
> perfectly 
> what is the time offset between the server and the user. And this is 
> based only on the TZ info stored in my apache config file and 
> the user 
> table.
> 
> Kindest regards,
> Venelin
> 
> Gryffyn, Trevor wrote:
> 
> >I did a quick search for some of the timezone names and 
> didn't quickly
> >find a list that included the GMT offset (also called the UTC offset
> >sometimes.. I think GMT and UTC are the same).
> >
> >BUT..  In general the timezones go hour by hour so if you 
> used something
> >Excel (or some spreadsheet), created a list of your 
> timezones, found the
> >offset of the first one, then did a +1 on the next one...  
> On down the
> >list.  That'd get you close to what you wanted.  Then find a 
> decent list
> >of offsets and insert rows where you have stuff like Indiana 
> or places
> >that have a 1/2 hour offset.
> >
> >
> >After that, I'd copy/paste the list into a good PHP editor that has
> >macro functions (I use Crimson Editor  
> http://www.crimsoneditor.com) and
> >record a macro to format the lines in such a way that ends 
> up building a
> >new array in PHP.
> >
> >If you've never done this, it's easy.
> >
> >Say you start with some lines like this:
> >
> >$TZs[]='US/Alaska';
> >$TZs[]='US/Aleutian';
> >$TZs[]='US/Arizona';
> >
> >
> >You'd record a macro in Crimson Editor that does this:
> >
> >(1)
> ><place cursor here and start RECORD MACRO>$TZs[]='US/Alaska';
> >
> >(2)
> ><Hold CTRL-SHIFT and tap RIGHT ARROW until you get to just 
> before the US
> >and hit DELETE>
> ><this is what you have now>US/Alaska';
> >
> >(3)
> ><hit END to go to the end of line and delete two characters>
> >US/Alaska
> >
> >
> >You now have just your timezone...   You may have a list like this
> >already though.
> >
> >(4)
> ><hit the down arrow to put you at the beginning of the next
> >line>$TZs[]='US/Aleutian';
> >
> >End macro recording.  Now all you have to do is hold down (in Crimson
> >Editor) the ALT-Macro# key (I reuse ALT-1 constantly) until 
> it finishes
> >doing these actions to all lines.
> >
> >
> >(5) Copy and paste this list into Excel or something
> >
> >
> >Now after you get your numbers in Excel and you've adjusted 
> for the odd
> >timezones.  You'd do another macro like this:
> >
> >US/Alaska    +1
> >US/Aleutian  +2
> >US/Arizona   +3
> >
> >(when you paste from Excel into Crimson Editor, you should have TABs
> >between the names and TZ #'s... Note, the TZ offsets listed 
> above aren't
> >accurate, just using numbers as examples.  There's no way Alaska is 1
> >hour ahead of GMT)
> >
> >(1)
> ><position cursor at beginning of line again>US/Alaska        +1
> >
> >(2)
> >Enter something like:
> >$tz["
> >
> >So you end up with:
> >
> >$tz["US/Alaska       +1
> >
> >(2)
> ><in this case, you can't just go to the END of the line and 
> cursor back
> >X # of characters or even tab back.  +1 and +3.5 are too different
> >tab-wise.. So maybe we'd do a FIND for "+" and hit DELETE to 
> remove the
> >+.
> >
> >(3)
> >After you do the FIND and DELETE, your cursor should be just 
> to the left
> >of the number.  Hit BACKSPACE to remove the tab, now you're in a good
> >position to continue your array building:
> >
> >$tz["US/Alaska<cursor is here>1
> >
> >(4) Enter some middle line stuff:
> >
> >$tz["US/Alaska"] = <cursor is here>1
> >
> >(5)
> >Now finish the line.  Hit END to take you to the end of the 
> line, enter
> >a semicolon, then cursor down and HOME to take you to the 
> beginning of
> >the next line so you can do it all over again.
> >
> >$tz["US/Alaska"] = 1;
> ><cursor is now here>US/Aleutian      +2
> >US/Arizona   +3
> >
> >
> >Again, hold down ALT-Macro# to repeat this for all lines.
> >
> >I know that's not exactly what you're looking for, but that's a quick
> >tutorial in how to make your life easier using macros when processing
> >larger lists of data.  Like I said, I didn't see a good list of world
> >timezone data.
> >
> >Here's some US TZ data with offset data:
> >http://www.statoids.com/tus.html
> >
> >Actually, here's one with international, but it's not formatted in a
> >good way to paste right into your PHP code, so you might use the
> >technique I mentioned above to get close then correct the anomalies:
> >http://home-4.tiscali.nl/~t876506/Multizones.html
> >
> >
> >As for 'local time', that's going to be the time that's set on the
> >server that PHP is running on.  This is called "local time" 
> or "system
> >time" or any number of things relating to the system, server 
> or whatever
> >that PHP is running on.   If the time set on the server is wrong, all
> >your PHP stuff is going to be wrong.
> >
> >There's no real good way of knowing the user's local time or timezone
> >without them telling you.  You might be able to get the 
> information via
> >Javascript and submit it back to PHP with a hidden form element or
> >something.  Or you could just ask the user.  But timezones are
> >complicated with daylight savings time and all.  Not impossible to
> >figure out, but tricky.  It's easier to ask the user to set 
> their local
> >time or something then to automatically calculate it.
> >
> >I hope that answered more questions then it generated..hah.  
> But if you
> >do have more questions, feel free to email me.
> >
> >Good luck!
> >
> >-TG
> >
> >  
> >
> >>-----Original Message-----
> >>From: Venelin Arnaudov [mailto:[EMAIL PROTECTED] 
> >>Sent: Monday, November 22, 2004 7:12 AM
> >>To: Gryffyn, Trevor
> >>Cc: [EMAIL PROTECTED]
> >>Subject: Re: [PHP] Timezones
> >>
> >>
> >>Hi Trevor,
> >>
> >>I have list of Timezones (see the attachment) but I do not know the 
> >>offset in respect of GMT.  Then I will be able to calculate 
> my local 
> >>time for every user local input.
> >>
> >>I would like to know which PHP date/time functions operate with the 
> >>system time alone and which one take the timezone into 
> consideration. 
> >>When in the function description is mentioned "local time" 
> what does 
> >>this mean? User local or system local?
> >>
> >>Kindest regards,
> >>Venelin
> >>
> >>Gryffyn, Trevor wrote:
> >>
> >>    
> >>
> >>>Don't know if this helps, but this was a message regarding 
> >>>      
> >>>
> >>Windows based
> >>    
> >>
> >>>long timezone formats that was posted a little while ago by another
> >>>user:
> >>>
> >>>
> >>>---------------------------------------
> >>>Kim [EMAIL PROTECTED]
> >>>Managed to find it !!!! It helps using just those right 
> >>>      
> >>>
> >>keywords after a
> >>    
> >>
> >>>million goes....
> >>>http://www.steltor.com/notes/corptime-server/5_4/refmanual/re
> >>>      
> >>>
> >>fappd.htm
> >>    
> >>
> >>>this
> >>>is a list of all timezone notations. Thanks for your help. 
> >>>      
> >>>
> >>Thought about
> >>    
> >>
> >>>the
> >>>long way but it was not a pleasant thought as you may imagine, was
> >>>hoping to
> >>>avoid at all costs. Hopefully this sorts it.
> >>>---------------------------------------
> >>>
> >>>
> >>>You might want to build a table or a list in some way 
> >>>      
> >>>
> >>that'll return the
> >>    
> >>
> >>>GMT offset for you.
> >>>
> >>>Let us know what you end up doing.
> >>>
> >>>-TG
> >>>
> >>> 
> >>>
> >>>      
> >>>
> >>>>-----Original Message-----
> >>>>From: Venelin Arnaudov [mailto:[EMAIL PROTECTED] 
> >>>>Sent: Friday, November 19, 2004 6:57 AM
> >>>>To: [EMAIL PROTECTED]
> >>>>Subject: [PHP] Timezones
> >>>>
> >>>>
> >>>>Hi,
> >>>>
> >>>>I have a legacy PHP3 system and a MySQL DB with two tables:
> >>>>user {
> >>>> user_id int,
> >>>> timezone varchar (like "Europe/Brussels", "US/Eastern", 
> >>>>"America/New_York", etc.)
> >>>>}
> >>>>and
> >>>>messages {
> >>>> msg_id int,
> >>>> user_id int,
> >>>> date int
> >>>>}
> >>>>
> >>>>When a user submits a message, my PHP script (using time() 
> >>>>        
> >>>>
> >>function) 
> >>    
> >>
> >>>>stores the submission time in messages.date field. However 
> >>>>this value is 
> >>>>not the server's system time but shifted according the 
> >>>>        
> >>>>
> >>users timezone.
> >>    
> >>
> >>>>1. How can I convert it to reflect my timezone (ex. GMT)? Is 
> >>>>there a way 
> >>>>to find the offset between two timezones given in long format 
> >>>>as in my 
> >>>>table?
> >>>>2. I would appreciate any information on how the PHP/Apache 
> >>>>handles the 
> >>>>timezone offset when calculating the time. Which of the PHP 
> >>>>        
> >>>>
> >>date/time 
> >>    
> >>
> >>>>functions take into consideration the environment variable TZ 
> >>>>(upon user 
> >>>>login there is putenv('TZ='.user_get_timezone()); command)?
> >>>>
> >>>>Thank you in advance,
> >>>>Venelin
> >>>>
> >>>>-- 
> >>>>PHP General Mailing List (http://www.php.net/)
> >>>>To unsubscribe, visit: http://www.php.net/unsub.php
> >>>>
> >>>>
> >>>>   
> >>>>
> >>>>        
> >>>>
> >>> 
> >>>
> >>>      
> >>>
> >
> >  
> >
> 

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

Reply via email to