having a problem with error message whilst using date/time function

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • anfetienne
    Contributor
    • Feb 2009
    • 424

    having a problem with error message whilst using date/time function

    Hi,

    I found a nice piece of code for the date and time and it allows for daylight savings, I have been using this code for a while and i've never had any error messages but for some reason I get a error message now but the function still does what it should.

    can anyone see what the problem is?

    this is the output from the php page
    Warning: Missing argument 3 for zonedate(), called in /home/veresour/public_html/streammii.com/q/dateTest.php on line 17 and defined in /home/veresour/public_html/streammii.com/q/dateTest.php on line 2

    Warning: Missing argument 4 for zonedate(), called in /home/veresour/public_html/streammii.com/q/dateTest.php on line 17 and defined in /home/veresour/public_html/streammii.com/q/dateTest.php on line 2

    16 Jul 2010 11:52:54
    and this is the code
    Code:
    <?
    function zonedate($layout, $countryzone, $daylightsaving, $time)
    {
    	if($daylightsaving) {
    		 $daylight_saving = date('I');
    		if($daylight_saving){ $zone=3600*($countryzone+1); }
    	}
    	else {
    		if( $countryzone>>0){ $zone=3600*$countryzone; }
    			else { $zone=0; }
    	}
    	if(!$time) { $time = time(); }
    	$date = gmdate($layout, $time + $zone);
    	return $date;
    }
    
    $dateAdded = zonedate('d M Y H:i:s',true);
    
    echo '<br/>'.$dateAdded;
    
    
    
    ?>
  • code green
    Recognized Expert Top Contributor
    • Mar 2007
    • 1726

    #2
    You are only passing two parameters to a function that expects four.
    If you are only using the first two then modify the function to
    Code:
    function zonedate($layout, $countryzone, $daylightsaving=true, $time=0)
    Which means by default, daylight saving will always be applied and system time will be used.

    Comment

    • anfetienne
      Contributor
      • Feb 2009
      • 424

      #3
      works like a charm... thank you for your help! once i've finished my project i'll be posting a link so everyone can see what the help was all for

      always appreciated

      Comment

      Working...