How to get timezone value
开发者_如何学编程how to get the timezone drop down menu in frontend magento?
Here is the code to get all timezones:-
$timezones = Mage::getModel('core/locale')->getOptionTimezones();
echo "<pre>";
print_r($timezones);
echo "</pre>";
You will be getting an array. You can loop through the array and populate the selection/dropdown list like below:-
<select>
<?php
foreach($timezones as $timezone) {
?>
<option value="<?php echo $timezone['value']; ?>"><?php echo $timezone['label']; ?></option>
<?php
}
?>
</select>
Thanks.
精彩评论