jester626 Posted December 2, 2006 Share Posted December 2, 2006 I am playing around with strtotime and I have managed to come up with a sequence of code that works ok. What I am wanting to know from the community is if there is a better way to 'code' this an still achieve the same end result.Here is what I am currently using:<?PHP$math58 = "58"*"86400";$timestampmain = strtotime("12 October 2006");$timestampmath = "$timestampmain" + "$math58";echo date("m-d-Y",$timestampmath); ?>Thank in AdvanceJess Link to comment https://forums.phpfreaks.com/topic/29219-strtotime-help-with-better-syntax/ Share on other sites More sharing options...
kenrbnsn Posted December 2, 2006 Share Posted December 2, 2006 First you don't need all those double quotes, especially when you do math.It looks like you want to get the date 58 days from the original date. You can do that within strtotime() itself.[code]<?phpecho date('m-d-Y',strtotime("12 October 2006 + 58 days"));?>[/code]Ken Link to comment https://forums.phpfreaks.com/topic/29219-strtotime-help-with-better-syntax/#findComment-133967 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.