sungpeng Posted June 25, 2009 Share Posted June 25, 2009 hi I got a listdate field 2009-06-23 03:31:49. In php echo "$row[time]"; if($row[time] more than 5 days){ cannot edit anymore } ($row[time] more than 5 days), can I check with all of you how to code? Link to comment https://forums.phpfreaks.com/topic/163581-solved-if-date-expire-cannot-edit/ Share on other sites More sharing options...
chmpdog Posted June 25, 2009 Share Posted June 25, 2009 wait.. so whats your question? Link to comment https://forums.phpfreaks.com/topic/163581-solved-if-date-expire-cannot-edit/#findComment-863084 Share on other sites More sharing options...
sungpeng Posted June 25, 2009 Author Share Posted June 25, 2009 if($row[time] >5 of current date){ echo "is done"; } else { echo "is not done yet"; } The "$row[time] >5 of current date" Can I know how to code? Link to comment https://forums.phpfreaks.com/topic/163581-solved-if-date-expire-cannot-edit/#findComment-863091 Share on other sites More sharing options...
chmpdog Posted June 25, 2009 Share Posted June 25, 2009 five days minitues or seconds greater than the current date? Link to comment https://forums.phpfreaks.com/topic/163581-solved-if-date-expire-cannot-edit/#findComment-863092 Share on other sites More sharing options...
sungpeng Posted June 25, 2009 Author Share Posted June 25, 2009 yes current field in mysql is 2009-06-23 03:31:49 format Link to comment https://forums.phpfreaks.com/topic/163581-solved-if-date-expire-cannot-edit/#findComment-863098 Share on other sites More sharing options...
Alex Posted June 25, 2009 Share Posted June 25, 2009 yes current field in mysql is 2009-06-23 03:31:49 format Kind of an ugly date format, for doing something like this a UNIX time stamp would be preferred. But you can do something like: $part = explode(' ', $row['time']) $day = explode('-', $part[0]); if($day[2] + 5 >= date("j")) { //Can edit } else { //can't } Link to comment https://forums.phpfreaks.com/topic/163581-solved-if-date-expire-cannot-edit/#findComment-863103 Share on other sites More sharing options...
chmpdog Posted June 25, 2009 Share Posted June 25, 2009 I agree I always store my time as unix Link to comment https://forums.phpfreaks.com/topic/163581-solved-if-date-expire-cannot-edit/#findComment-863115 Share on other sites More sharing options...
sungpeng Posted June 25, 2009 Author Share Posted June 25, 2009 Thank Link to comment https://forums.phpfreaks.com/topic/163581-solved-if-date-expire-cannot-edit/#findComment-863126 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.