Page 1 of 1

Problem with upgrade?

Posted: Thu Oct 04, 2007 4:05 pm
by jayboy
I am using the following code snipped for when somebody enters a date range:

**** PLEASE USE PHP AND CODE TAGS *****

Code: Select all

// date string processing
	if ($date_select == "By Appointment" || $date_select == "Call for Info" || $date_select == "Ongoing") {
		$date_preview = $date_select;
	}
	else {
		$date_preview = '';
		if ($date_select == "range") {
			$date_1alt = substr($date_1,3,3).substr($date_1,0,3).substr($date_1,6,4);
			$date_2alt = substr($date_2,3,3).substr($date_2,0,3).substr($date_2,6,4);
			$date_preview = date('M. j', strtotime($date_1alt))." to ".date('M. j', strtotime($date_2alt));
		}
		elseif ($date_select == 1) {
			$date_1alt = substr($date_1,3,3).substr($date_1,0,3).substr($date_1,6,4);
			$date_preview = date('M. j', strtotime($date_1alt));
		}
		elseif ($date_select == 2) {
			$date_1alt = substr($date_1,3,3).substr($date_1,0,3).substr($date_1,6,4);
			$date_2alt = substr($date_2,3,3).substr($date_2,0,3).substr($date_2,6,4);
			$date_preview = date('M. j', strtotime($date_1alt)).", and ".date('M. j', strtotime($date_2alt));
		}
		elseif ($date_select == 3) {
			$date_1alt = substr($date_1,3,3).substr($date_1,0,3).substr($date_1,6,4);
			$date_2alt = substr($date_2,3,3).substr($date_2,0,3).substr($date_2,6,4);
			$date_3alt = substr($date_3,3,3).substr($date_3,0,3).substr($date_3,6,4);
			$date_preview = date('M. j', strtotime($date_1alt)).", ".date('M. j', strtotime($date_2alt)).", and ".date('M. j', strtotime($date_3alt));
		}
	}
It was working fine on PHP 4.0, but now that we have upgraded to PHP 5.0.3 the date range is off by about 6 months. Any ideas?

Tyler

Posted: Fri Oct 05, 2007 10:09 am
by feyd
Examples of input? Examples of expected variable states at the various locations? Actual variable states at the various locations?

Posted: Tue Oct 09, 2007 2:26 pm
by jayboy
The inputs come from a calendar. The dates that actually show up are about 6 months off. The reason I wonder if this might be due to PHP versions is that it worked fine until we upgraded to PHP 5.0.3.

Posted: Tue Oct 09, 2007 2:29 pm
by jayboy
Also, I should note that I am still running PHP 4.0 on my test computer and the script still works fine on that, but on the computer with PHP 5.0.3 it has the problem.

Posted: Tue Oct 09, 2007 2:32 pm
by Zoxive
feyd wrote:Examples of input? Examples of expected variable states at the various locations? Actual variable states at the various locations?
jayboy - You still never gave any REAL examples. Saying where they came from doesn't show us the format and such that you are using.