Arithmetic operations on date and time

Hello, the following question arose, in the database you need to store the date and time (for example, 12:30:00 01-06-2012), then in the script you need to get the date of the person who entered, and subtract from the data from the database received from user data, and display the result according to the example: 2d. 14-30-45.

I turned the reference book, but something without results, tell me how to do this? In what format to store data in the database, how to perform an arithmetic operation on a date? I met an analogue on the site (not advertising), they have a similar one in the header.

Answer 1, authority 100%

In php there is a class DateTimeand there is a method sub

Leave a reply

Please enter your comment!
Please enter your name here