Set time offset in php

前端 未结 1 988
春和景丽
春和景丽 2021-01-27 18:22

Is there some way to return all date returned by the date() function to be offset by some specific amount of time ? I tried date-default-timezone-set(), didn\'t seem to work on

1条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-27 18:45

    You could also write your own version of the date() function which returns the date processed by the callback you require (adding an offset).

    If you really want to just call date(), i.e. for sake of consistency, you could write your app in your own namespace and simply name your custom function date(). In that case, PHP's original date() function has to be called as \date().

    0 讨论(0)
提交回复
热议问题