这让我很困惑.我的模型中有一个用 DateTime 注释的属性.在我的数据库中,它存储为时间戳.在前端我使用 f:format.date viewhelper 来输出这个属性.
Its confusing me. I've a property in my Model which is annotated with DateTime. In my Database its stored as timestamp. In Frontend I use the f:format.date viewhelper to output this property.
当我创建新记录并添加 f.e.01.06.2017 10:00 在这个字段中,在我的数据库中存储了 01.06.2017 08:00 的时间戳.在前端输出是正确的.直到这里一切都很好.
When I create a new record, and add f.e. 01.06.2017 10:00 in this field, in my database is stored the timestamp for 01.06.2017 08:00. In Frontend the output is correct. Until here everything is fine.
三月份的最后一次时间更改导致输出增加了两个小时.我假设 10 月会再次改变,输出将比这个:01.06.2017 08:00.
The last timechange in March lead to a + of two hours in output. I assume in October that will change again and the output will be than this: 01.06.2017 08:00.
我怎样才能防止这种情况发生.当这些日期改变时,这绝对是一个问题,因为它对业务很重要.
How can I prevent this. Its definitely a problem when these dates change, because its important for the business.
我如何测试 10 月份会发生什么?
How can I test what will happen in October?
问题发生是因为 TYPO3 将时间标准化为 UTC.对于规范化(以及随后的非规范化),它尊重服务器的时区设置.或 LocalConfiguration.php.
中给出的设置在 6.2 之前,有两个设置 [SYS][serverTimeZone]
和 [SYS][phpTimeZone]
.
在 7.6 中,它只是 [SYS][phpTimeZone]
,因为服务器时区是从 php 本身检测到的.
The Problem occurs as TYPO3 saves times normalized as UTC. for normalization (and afterwards denormalization) it respects the timezone-settings of the server. Or settings given in LocalConfiguration.php.
Up to 6.2 there were two settings [SYS][serverTimeZone]
and [SYS][phpTimeZone]
.
With 7.6 it is only [SYS][phpTimeZone]
as the servertimezone is detected from php itself.
您现在可以选择通过将 [SYS][phpTimeZone]
设置为字符串UTC"来将服务器的时区伪装为UTC".这样一来,时间就不能再改变了.
You now have the option to fake the timezone of your server to "UTC" by setting [SYS][phpTimeZone]
to the string "UTC". In this way no times should be changed any more.
这篇关于使用 TYPO3 和 Fluid 正确处理时区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!