Jump to content

[SOLVED] php date


c172cpt

Recommended Posts

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-

Link to comment
https://forums.phpfreaks.com/topic/67702-solved-php-date/
Share on other sites

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...

Link to comment
https://forums.phpfreaks.com/topic/67702-solved-php-date/#findComment-340101
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.