Skip to content
Advertisement

Tag: datetime

PHP convert UTC time to local time

Am getting a UTC time from my server like the following format, my requirement is to convert the UTC time to local time. So users can see a user friendly time on their browser based on their timezone. Please help me to solve this issue. Thank you I have tried some methods but not working in my case First Second

Modify microseconds of a PHP DateTime object

I have a PHP DateTime object with microseconds created as follows: How can I modify the microseconds value of $dt, without creating a completely new DateTime instance? Answer You can’t. There are three methods that can modify the value of a DateTime instance: add, sub and modify. We can rule out add and sub immediately because they work in terms

PHP DateTime round up to nearest 10 minutes

I’m retrieving a datetime from a mysql field but I need to round it up to the nearest 10 minutes. For example, If the datetime is 2013-11-06 14:00:01, I’d like to return the time as 6/11/2013 14:10. What’s the easiest way to do this? Any advice appreciated. Thanks. Answer 1) Set number of seconds to 0 if necessary (by rounding

Round datetime to last hour

I tried to look for this but I could not find good example of this what im trying to do. I got datetime values in MySQL database that has to be rounded down when that value is on use. Example, all …

Advertisement