mepman Posted June 25, 2007 Share Posted June 25, 2007 Ive just started to learn PHP and got hold of some open source game scripts and have started to edit them as im learning i wanted to add a jail system but needing some help. Anyway here is what im trying to do, this may seem really stupid to advanced people. I have 2 fields 'jailstart' and 'jailend' when they go to jail i update jailstart with date("U") and then jailend with date("U")+120; < So 2 minutes. but now i need to display it as such so it says You have 2 minutes left in jail. So i need to convert date("U") to minutes if thats possible or even doing this another way thanks in advance!! Link to comment https://forums.phpfreaks.com/topic/57124-datetime-question/ Share on other sites More sharing options...
Orio Posted June 25, 2007 Share Posted June 25, 2007 <?php //lets suppose that the "jailend" is in the variable $end $diff = time()-$end; if($diff <= 0) echo "You are free!"; else { $mins = $dif%60 +1; echo "You are in jail for ".$mins." more minutes!"; } ?> Orio Link to comment https://forums.phpfreaks.com/topic/57124-datetime-question/#findComment-282274 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.