A record is set into my dbtable using NOW() and datetime. Now I want this record to be editable the next 48 hours but after that timelimit it should be locked…
This is what I want to do:
$currDate = strftime('%Y-%m-%d %H:%I:%S');
$tableDate = strftime($row['date']);
if(// If date is within the 48 hours limit do something here //){
} else {
// If date is passed the timelimit //
}
i’m not sure exactly what $row[‘date’] contains. if it is just a date then it’s not possible to accurately do 48 hours from when the record is set because the time info is missing.
let’s assume you can get a timestamp value of when the update was made somehow, say into $updated_ts, then:
$updated_ts = .....
if( (time() - $updated_ts) <= (2*24*60*60) ) {
// If date is within the 48 hours limit
} else {
// If date is passed the timelimit
}