timestamp in dailylight savings time
Anyone have a function to get a timestamp time()
in daylight savings time? An开发者_Go百科d possibly GMT+1 insted of GMT. I need it to display timestamps of comments made on my site.
Timestamps are the number of seconds elapsed since January 1st, 1970 GMT. That's a fixed number, not depending on whether you're saving daylight and independent of timezones. When you convert back to "human readable time", that's when your timezone and DST settings need to be taken into account. Set your timezone correctly or explicitly set a timezone on a DateTime object when formatting a timestamp to make this work.
You should set your timezone to php setting. There are some ways to do it:
- date_default_timezone_set function
- date.timezone ini setting
After that all time functions willl work in this timezone
精彩评论