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? Quote Link to comment Share on other sites More sharing options...
chmpdog Posted June 25, 2009 Share Posted June 25, 2009 wait.. so whats your question? Quote Link to comment 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? Quote Link to comment 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? Quote Link to comment 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 Quote Link to comment 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 } Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
sungpeng Posted June 25, 2009 Author Share Posted June 25, 2009 Thank Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.