Problem with upgrade?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jayboy
Forum Newbie
Posts: 3
Joined: Thu Oct 04, 2007 4:00 pm

Problem with upgrade?

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Examples of input? Examples of expected variable states at the various locations? Actual variable states at the various locations?
jayboy
Forum Newbie
Posts: 3
Joined: Thu Oct 04, 2007 4:00 pm

Post 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.
jayboy
Forum Newbie
Posts: 3
Joined: Thu Oct 04, 2007 4:00 pm

Post 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.
User avatar
Zoxive
Forum Regular
Posts: 974
Joined: Fri Apr 01, 2005 4:37 pm
Location: Bay City, Michigan

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