Jump to content

Subtracting from a date


TapeGun007

Recommended Posts

There's nothing wrong with the line of code you posted. It will subtract one from any value in $tempyear and assign that to $year, even if $tempyear does not exist or is a null value or if it is a character string.

 

How do you know you are getting nothing? What value should you be getting? What is your actual code that exhibits the problem?

 

  >.<

 

hmm... weird.  I thought I had put an echo statement to show the year and it was coming up.  Now it isn't at all.  I simply assigned the year the correct value and it works fine.

 

I'm not sure what I was seeing originally or what I did, but I must've made an error somewhere in my troubleshooting. LOL.  Originally, I was getting an error on this: $days_in_month = cal_days_in_month(CAL_GREGORIAN, $month, $year) ;  because $year had no value.  I thought maybe cal_days_in_month had changed, so I echoed the $year to find it had no value.  I then placed that echo command earlier and ... well... I thought it was returning a value... I guess not.

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.