2009/1/20 Lyle <webmas...@cosmicperl.com>: > Hi, > I've been working on a membership system, letting users select their > timezone when the signup.
Excellent - too many apps don't have this. > I'm a bit confused as how to generate the timezone selection box. I've tried > the routines:- > > use DateTime::TimeZone; > my @array = DateTime::TimeZone->all_names; > print "@array\n\n"; > @array = DateTime::TimeZone->categories; > print "@array\n\n"; > my %hash = DateTime::TimeZone->links; > foreach my $key (keys %hash) { > print "$key = $hash{$key}\n"; > }#foreach > > But 'all_names' and 'links' both return a lot of options, 'categories' > doesn't return enough. 'all_names' should return all that you need. > Is there something similar to the time zone selection you get in Windows or > similar programs? The GMT, GMT+1, etc... You really don't want to do that. Many users don't really understand timezones, but almost all know where they are. As an example - say you are in the UK and it is mid April - should you choose GMT or GMT+1? Has BST kicked in yet? And will you remember to log in again and change your settings when BST ends, whenever that is. Choose 'Europe/London' and all the magic happens for you. Also these timezone names can be localised for your users if you ever change the language of your site. Don't forget to be religious about storing all times as UTC in your database etc. Cheers, Edmund. > Right now I think I must be missing something and I can't see how to get > what I need... > > Help much appreciated. > > > Lyle > > -- e...@ecclestoad.co.uk - http://ecclestoad.co.uk