I want to store the current time in a mysql database with php. I would like the format to be:
yyyymmddttmmss
but any format will do for now.
If it doesn't work in php, can I get the date/time with a perl script?
You don't need to. Check out the DATETIME datatype for mysql. It stores and retrieves in two formats. A string "YYYY-MM-DD HH:MM:SS" or as an interger YYYYMMDDHHMMSS
I want to compare the current date with the one stored in the mysql database to check time difference. How do I do that?
You can use the mysql date/time functions, specifically date_add() and date_sub().
Let's say you want the records where date is less than 7 days old.
select * from table where date_add(date_field, interval 7 day)> now();