|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi All,
I have a field in a Mysql DB of type Date which stores the current date of inserting data. I want a PHP script that determines the difference between the Current date and the date the data was posted in the MySQL DB/Table (past date). The script is to delete all rows in my table which have been stored in the table for more than a specified number of days (say 14days). I'm using PHP Ver 4 and MYSQL 4.1 |
|
#2
|
||||
|
||||
|
Why use PHP for this?
simply use mysql: Code:
DELETE FROM tableName WHERE DATE_ADD(dateColumn, INTERVAL 14 DAY) < CURRENT_TIMESTAMP; |
|
#3
|
|||
|
|||
|
Quote:
Thanx Itascon, I've been able to deal with my date problem. Regards, Capt. Morgan |
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > How do I get the Difference between Current and past Dates? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|