c172cpt Posted September 2, 2007 Share Posted September 2, 2007 im having a problem ive looked around and cant figure it out i have a 95 line switch statement to compleate the task but i want to simplify the code i want to take the current date ("XX") minus 10 days regardless of the month or year and get a new date ex: $past = $today - 10; my issue lies when $past is negitive how can i solve this any ideas -scott- Quote Link to comment https://forums.phpfreaks.com/topic/67702-solved-php-date/ Share on other sites More sharing options...
ToonMariner Posted September 2, 2007 Share Posted September 2, 2007 if you don't need full gregorian calendar support you can just use the timestamp $now = mktime(); $then = $now - (60*60*24*10); then you can use that timstamp in the date function... I am intrigued by you massive switch statement - sounds like the ideal candidate for some OOP with a splash of polymorphism to me... Quote Link to comment https://forums.phpfreaks.com/topic/67702-solved-php-date/#findComment-340101 Share on other sites More sharing options...
c172cpt Posted September 3, 2007 Author Share Posted September 3, 2007 that solved my problem thanks, -scott- Quote Link to comment https://forums.phpfreaks.com/topic/67702-solved-php-date/#findComment-340168 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.