Reply to Re: Working with Timezones and DST

Your name:

Reply:


Posted by Andy Hassall on 05/27/07 14:42

On 27 May 2007 07:15:14 -0700, Daz <cutenfuzzy@gmail.com> wrote:

>Hi Andy. That's wonderful. Thank you very much for such a great
>example. Sadly, the server I am doing this project for, is running PHP
>4...

Not so bad, since the TZ environment variable will still work. From another
server:

$ php -v
PHP 4.3.10 (cli) (built: Jan 12 2005 13:10:04)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies

$ php test.php
Sun, 27 May 2007 14:34:24 +0000 (TZ=US/Eastern)
Sun, 27 May 2007 14:34:24 +0000 (TZ=US/Central)
Sun, 27 May 2007 14:34:24 +0000 (TZ=UTC)
Sun, 27 May 2007 15:34:24 +0100 (TZ=Europe/London)
Sun, 27 May 2007 16:34:24 +0200 (TZ=Europe/Paris)

OK, that server won't take US/Eastern or Central - they're wrongly coming out
as +0000. It apparently takes the city-based US timezones, though:

Sun, 27 May 2007 10:39:44 -0400 (TZ=America/New_York)
Sun, 27 May 2007 09:39:44 -0500 (TZ=America/Chicago)
Sun, 27 May 2007 14:39:44 +0000 (TZ=UTC)
Sun, 27 May 2007 15:39:44 +0100 (TZ=Europe/London)
Sun, 27 May 2007 16:39:44 +0200 (TZ=Europe/Paris)

The supported timezone names in PHP 4 rely entirely on the operating system -
in this case it seems FreeBSD's timezones list differs slightly from Linux.

PHP 5's improved support is useful as it has its own timezone database, so
it's more portable.

>Am I correct in saying that DST has been accounted for in your
>example? It looks like it has, but I need to be certain.

Yes, it has. See "Europe/London" being +1 as we're in British Summer Time at
the moment.
--
Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация