douping1993 2019-06-17 07:20
浏览 300

时区格式化不返回某些时区的缩写

I'm a bit confused as to why the date formatter T does not always return a timezone abbreviation.

The following code Carbon::now()->timezone('Europe/London')->format('T') returns 'BST', Carbon::now()->timezone('Europe/Stockholm')->format('T') returns 'CEST', but Carbon::now()->timezone('Asia/Bangkok')->format('T') returns '+07', which is rather confusing for the users of a scheduling system I'm building.

I would expect T to always return a 'non-numeric' indication of the timezone, is there a way to achieve this without having to resort to writing out 'Asia/Bangkok'?

  • 写回答

1条回答 默认 最新

  • duanping6698 2019-08-15 08:35
    关注

    It should return "ICT". It's a known bug of PHP: https://bugs.php.net/bug.php?id=74835

    You get the same result without Carbon:

    $date = new DateTime('now', new DateTimeZone('Asia/Bangkok'));
    echo $date->format('T');
    
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器