473,385 Members | 1,732 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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

anfetienne
424 256MB
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
Expand|Select|Wrap|Line Numbers
  1. <?
  2. function zonedate($layout, $countryzone, $daylightsaving, $time)
  3. {
  4.     if($daylightsaving) {
  5.          $daylight_saving = date('I');
  6.         if($daylight_saving){ $zone=3600*($countryzone+1); }
  7.     }
  8.     else {
  9.         if( $countryzone>>0){ $zone=3600*$countryzone; }
  10.             else { $zone=0; }
  11.     }
  12.     if(!$time) { $time = time(); }
  13.     $date = gmdate($layout, $time + $zone);
  14.     return $date;
  15. }
  16.  
  17. $dateAdded = zonedate('d M Y H:i:s',true);
  18.  
  19. echo '<br/>'.$dateAdded;
  20.  
  21.  
  22.  
  23. ?>
  24.  
Jul 16 '10 #1

✓ answered by code green

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
Expand|Select|Wrap|Line Numbers
  1. function zonedate($layout, $countryzone, $daylightsaving=true, $time=0) 
  2.  
Which means by default, daylight saving will always be applied and system time will be used.

2 1363
code green
1,726 Expert 1GB
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
Expand|Select|Wrap|Line Numbers
  1. function zonedate($layout, $countryzone, $daylightsaving=true, $time=0) 
  2.  
Which means by default, daylight saving will always be applied and system time will be used.
Jul 16 '10 #2
anfetienne
424 256MB
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
Jul 16 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Karuna | last post by:
Hi everybody, I have been trying to write a simple mail script using PHP and apache on Windows XP. Eventhough the script is saying that the mail is successfully sent, I am unable get it in my...
5
by: aleksander.helgaker | last post by:
I've completely rewritten a calculator I wrote to help me learn Python. After someone told me about the def command I reliesed that I could make the program much better, but there is a very anoying...
3
by: Baren | last post by:
Hi! I have a requirement, where in I am saving the events based on certain date seleceted from the drop down values. Onces saved the data is stored in database. I have calendar control which...
3
by: Richard Finnigan | last post by:
Hi I was wondering if anyone could help me with this problem. I've been using VWD and my webhost ( a shared hosting package) have told me that the MSQL express files wont work on thier server so...
1
by: Simon | last post by:
Dear reader, Some times I receive an error message by using the functions: Left(;2) Mid(;5;2)
1
by: access baby | last post by:
How to use Date and time function in query i would like to use parameter Query where i will enter the start and end date. i want the query to return days hours minutes and seconds worked on...
6
gregerly
by: gregerly | last post by:
Hello all, I appologize if this is the wrong place for this post. Not sure where else it would go. I am building a shopping cart with PHP. I know that on a page where you would collect the user...
7
by: Shani Aulakh | last post by:
Hi there, I have a FolderWatcher.cs class that will monitor a given folder and delete files older than X number of days. I have the following methods. I need to add/show delete mothod using date...
4
by: dantebothermy | last post by:
I'm trying to use docmd.openform, passing a parameter using openargs. I keep getting this error message: "The expression you entered refers to an object that is closed or doesn't exist." The...
10
by: surferj | last post by:
I am beginning to receive an error message when trying to execute the .Send command when using the CDO.Configuration and CDO.Message in a W2k3 server environment on WXP machines and IE6. Below is a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.