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. Quote 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? Quote 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. Quote 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')); Quote 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? Quote 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 Quote 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. Quote Link to comment https://forums.phpfreaks.com/topic/132489-solved-php-mktime-help/#findComment-688937 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.