开发者

PHP locale framework for alternative to native locale system (like setlocale)

开发者 https://www.devze.com 2023-01-29 13:49 出处:网络
I always had a problem that translate English date to Thai. When server not support localization, it must be problem that i can\'t use date() function properly.

I always had a problem that translate English date to Thai. When server not support localization, it must be problem that i can't use date() function properly.

So, is 开发者_运维技巧there any framework or best practice to handle with server that don't have our locale installed. For now, I use workaround by hardcode map English text <=> Thai text.

Thanks you.


You could use the PHP library DateTime

Example:

$d = new DateTime($myLATimeStampString, new DateTimeZone('America/Los_Angeles'));
$d->setTimezone(new DateTimeZone('Europe/Oslo'));
$time = $d->format('m/d/Y H:i:s'); 
0

精彩评论

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