users to view in local timezone

后端 未结 2 949
温柔的废话
温柔的废话 2021-01-20 20:01

I\'ve asked a very similar question before but got no answers that helped.

I have a site that allows users to post notes. There will be a time stamp on those notes.

2条回答
  •  南方客
    南方客 (楼主)
    2021-01-20 20:30

    What you can do is save the UTC time when saving and when viewing show the UTC time + offset. This can all be done using JS on client side.

    JS method used when saving= UTC()

    JS method used when displaying =

    
    
    
    
    
     showDateInClientSideFormat($dateSaved); ';
    ?>
    
    
    

    PS: UTC time is the same as GMT time

提交回复
热议问题