PHP: Adding hours to timestamp fields while printing the formatted date. Comment. So imagine your MySQL is on a shared host and you have time stamps which. To get current datetime (now) with PHP you can use date with any PHP version, or better datetime class with PHP version greater than Carbon - A simple PHP API extension for DateTime.
Learn PHP - Time and Date If you want to format the difference between the two dates, you can use as well the format method of the DateInterval object but be careful: It is time to introduce this powerful PHP object. Time is represented as an offset in the amount of seconds that php date hour ticked away since midnight of January 1,UTC, php date hour. The output indicate that there is 1 day and 22 hours difference between the two dates. Why would we want it formatted right out of the database anyway?