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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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