开发者

How to get timezone value

开发者 https://www.devze.com 2023-02-17 07:00 出处:网络
开发者_如何学编程how to get the timezone drop down menu in frontend magento?Here is the code to get all timezones:-

开发者_如何学编程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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号