开发者

Changing the timezone strings of date_lang.php

CodeIgniter stores timezones for its date class in

system/language/english/date_lang.php

I would like to change the strings in this file so that

$lang['UM12']   = '(UTC -12:00) Baker/Howland Island';
$lang['UM11']   = '(UTC -11:00) Samoa Time Zone, Niue';

would instead be

$lang['-12:00'] = '(UTC -12:00) Baker/Howland Island';
$lang['-11:00'] = '(UTC -11:00) Samoa Time Zone, Niue';

Is this possible at all?

Any change I make to the UM__ portion of one line makes it show as a blank on the dropdown. The remaining (unchanged) lines appear OK.

I have also tried to开发者_C百科 clone this file to application/language/english/ with similar bad results.

Any insights on this?


It looks like this would require hacks to the date_helper.php file which I am not willing to do.

Instead, the date class in CI has the timezones() function which allows you to convert from, for example, UM5 to -5. In that case one can wrap this function around the U__ value coming from the view/dropdown -- and then save it to DB as -5 or some other INT.

Since I want to show the user their selected timezone on that same dropdown, I am forced to have DB fields for the U__ and INT timezone formats. As far as I know, there is no CI function to convert from -5 to UM5.

So, for the user, I pull the U__ format into the view to autopopulate the dropdown.

For timezone conversions and such, I use the INT format.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜