stormx Posted November 12, 2008 Share Posted November 12, 2008 I am having trouble forwarding this into the future by 3 days: date("n/j/Y") I've tried mktime(0, 0, 0, date("n") , date("j")+3, date("Y")); but the output is some random numbers. Is their anyway to get an output of: 11/14/2008 Thanks. Link to comment https://forums.phpfreaks.com/topic/132489-solved-php-mktime-help/ Share on other sites More sharing options...
stormx Posted November 12, 2008 Author Share Posted November 12, 2008 <?php $three = mktime(0, 0, 0, date("n")/-date("j")+3/-date("Y")); echo "$three"; ?> I tried this but got 1197442800, is their anyway to make it 11/14/2008? Link to comment https://forums.phpfreaks.com/topic/132489-solved-php-mktime-help/#findComment-688881 Share on other sites More sharing options...
premiso Posted November 12, 2008 Share Posted November 12, 2008 date Put date around mktime with the format following the guidelines on the date page. <?php $three = date("FORMATHERE", mktime(0, 0, 0, date("n")/-date("j")+3/-date("Y"))); echo "$three"; ?> Should work, just replace the FORMATHERE part with the format you want. Link to comment https://forums.phpfreaks.com/topic/132489-solved-php-mktime-help/#findComment-688883 Share on other sites More sharing options...
Barand Posted November 12, 2008 Share Posted November 12, 2008 echo date("n/j/Y", strtotime('+3 days')); Link to comment https://forums.phpfreaks.com/topic/132489-solved-php-mktime-help/#findComment-688891 Share on other sites More sharing options...
stormx Posted November 12, 2008 Author Share Posted November 12, 2008 I tried this: <?php $three = date("d/m/y", mktime(0, 0, 0, date("n")/-date("j")+3/-date("Y"))); echo "$three"; ?> But it keeps giving me 12/12/07, what did I do wrong? Link to comment https://forums.phpfreaks.com/topic/132489-solved-php-mktime-help/#findComment-688895 Share on other sites More sharing options...
stormx Posted November 12, 2008 Author Share Posted November 12, 2008 Thanks guys, figured it out Link to comment https://forums.phpfreaks.com/topic/132489-solved-php-mktime-help/#findComment-688897 Share on other sites More sharing options...
corbin Posted November 12, 2008 Share Posted November 12, 2008 Why are you bothing with mktime? 3 days never changes, therefore, strtotime, or just time()+24*60*60*3 would work just fine and be faster than mktime. Link to comment https://forums.phpfreaks.com/topic/132489-solved-php-mktime-help/#findComment-688937 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.