I download event calender from http://www.phpcodeworks.com/pec/installation. I am using PHP 5.3.X therefore browser said F:\xampp\htdocs\msj\functions.php so I replace :
$days = date("t", mktime(0,0,0,$month,1,$year));
with:
$days = date("t",` time(0,0,0,$month,1,$year));
but doing so each date goes 24 hours back as follows.
Image when using $days = date("t", mktime(0,0,0,$month,1,$year));
:
Image when using $days = date("t", time(0,0,0,$month,1,$year));
:
The mktime()
function returns the time in seconds from Unix Epoch (January 1 1970 00:00:00 GMT) to the date and time provided as parameters.
The time()
function retuns the time in seconds from Unix Epoch (January 1 1970 00:00:00 GMT) to the moment the function is run. There are no parameters to pass in.
So when browsing for a particular date, you will need to use mktime()
instead of time()
, time()
will constantly return a different number every time you run it. Because of that, your calendar will change every time you view it (even if you are trying to view a particular date).
Hightlight:
mktime()
- Time in seconds representing a specified date (see the documentation for the required parameters).
time()
- Time in seconds representing now (there are no parameters for this function).
mktime()
looks to be the appropriate function for this situation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With