php date() with leap year not working properly

I have a simple function which returns an array of dates for a 7 day period. When it comes to a leap year, this is not working properly. I does take into account Feb 29th 2012 but when you get to the beginning of April, it goes haywire and throws in 3/4 (April 3rd) twice! In the printed array result set number [5] and [6] are incorrect. Both show 3/4

Can anyone tell me how to fix this issue? Here is the function to test so you can see the issue.

function setDates(){
// Set mysql start date TS for day 1
$m = date('n', strtotime('2011-03-30'));
$d = date('j', strtotime('2011-03-30'));
$y = date('y', strtotime('2011-03-30'));
$startDateTS = mktime(0,0,0,$m,$d,$y);
for($x=0;$x<7;$x++)
      {
      $counter = $x;
      $miniDateHeader[$x] = date('j/n', $startDateTS + ($counter * 86400));
      }
      return $miniDateHeader;
}
$dateArray = setDates();
print_r($dateArray);

Thanks in advance. I must be missing something. Funny thing is, once you get past this 7 days and set the date to '2012-04-06' it displays the correct dates.

LVL 20
Mark BradyPrincipal Data EngineerAsked:
Who is Participating?
 
Ray PaseurCommented:
This may be a bug in PHP.  In theory, if I add one day to a date, I should always get the next day.  Look at the output from this script.
http://www.laprbass.com/RAY_temp_elvin66_3.php
<?php // RAY_temp_elvin66_3.php
error_reporting(E_ALL);
echo "<pre>";

// ABOUT LEAP YEAR
// http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_201-Handling-date-and-time-in-PHP-and-MySQL.html

// REQUIRED
date_default_timezone_set('Pacific/Auckland');


// ANOTHER TAKE
function RAY_dates($alpha='Today', $ndays=7)
{
    // VALIDATE THE START AND STOP TIMESTAMPS
    $alpha_ts = strtotime($alpha);
    if (!$alpha_ts) return FALSE;
    $omega = date('c', $alpha_ts) . " + $ndays DAYS";
    $omega_ts = strtotime($omega);
    if (!$omega_ts) return FALSE;

    // SET ISO-8601 DATES FROM THE TIMESTAMPS
    $alpha = date('c', $alpha_ts);
    $omega = date('c', $omega_ts);

    while ($alpha < $omega)
    {
        // ADD ONE DAY
        $alpha_ts = strtotime($alpha . ' + 1 DAY');
        $alpha    = date('c', $alpha_ts);

        // RECOVER THE RETURN VALUES STRING
        $array[]  = date('c', $alpha_ts);

    }
    return $array;
}
print_r(ray_dates());
print_r(ray_dates('March 28, 2011'));
print_r(ray_dates('March 28, 2012'));

// OVER NON-LEAP YEAR
print_r(ray_dates('February 26, 2011'));

// OVER LEAP YEAR
print_r(ray_dates('February 26, 2012'));

Open in new window

0
 
Dave BaldwinFixer of ProblemsCommented:
This is what I get from your code in PHP 5.2.17:

Array ( [0] => 30/3 [1] => 31/3 [2] => 1/4 [3] => 2/4 [4] => 3/4 [5] => 4/4 [6] => 5/4 )

That is the right sequence.  What are you getting?
0
 
Dave BaldwinFixer of ProblemsCommented:
I changed the year to 2012 and got the same thing.
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
Ray PaseurCommented:
Hey, Mate....

See http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_201-Handling-date-and-time-in-PHP-and-MySQL.html

Thanks for your many contributions here at EE.  See if this makes sense to you, and post back if you have questions. ~Ray
http://www.laprbass.com/RAY_temp_elvin66.php
<?php // RAY_temp_elvin66.pgp
error_reporting(E_ALL);
echo "<pre>";

// ABOUT LEAP YEAR
// http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_201-Handling-date-and-time-in-PHP-and-MySQL.html

// REQUIRED
date_default_timezone_set('America/Chicago');



// NOT THE WAY
function setDates(){
// Set mysql start date TS for day 1
$m = date('n', strtotime('2011-03-30'));
$d = date('j', strtotime('2011-03-30'));
$y = date('y', strtotime('2011-03-30'));
$startDateTS = mktime(0,0,0,$m,$d,$y);
for($x=0;$x<7;$x++)
      {
      $counter = $x;
      $miniDateHeader[$x] = date('j/n', $startDateTS + ($counter * 86400));
      }
      return $miniDateHeader;
}
$dateArray = setDates();
print_r($dateArray);



// TRULY THE WAY
function RAY_dates()
{
    $alpha = '2012-02-27';
    $omega = '2012-03-02';
    while ($alpha < $omega)
    {
        $timestamp = strtotime($alpha . " +1 DAY");
        $alpha = date('Y-m-d', $timestamp);
        $value[] = $alpha;
    }
    return $value;
}
print_r(ray_dates());

Open in new window

0
 
Mark BradyPrincipal Data EngineerAuthor Commented:
Hi Dave yes I got the incorrect values when using 2012 because of the leap year I can only assume. Works a treat for non leap year dates. I'll checkout Rays suggestion when I get home. thanks Ray and both you and Dave have a merry Xmas ok! you guys are true legends :)

Mark
0
 
Dave BaldwinFixer of ProblemsCommented:
What I meant was that I got the same values for both 2011 and 2012....
0
 
Mark BradyPrincipal Data EngineerAuthor Commented:
Oh I see - I misunderstood. Anyway this is quite interesting. Using my function above with different dates, this is what I get. I start with March 28. That displays as it should. Once I get to 29, that is where is all goes crazy. It seems to be hung up on the 3rd of March for some reason. Take a look at these results. Notice I am using the year 2011 which is NOT a leap year !

2011-03-28
Array ( [0] => 28/3 [1] => 29/3 [2] => 30/3 [3] => 31/3 [4] => 1/4 [5] => 2/4 [6] => 3/4 )

2011-03-29
Array ( [0] => 29/3 [1] => 30/3 [2] => 31/3 [3] => 1/4 [4] => 2/4 [5] => 3/4 [6] => 3/4 )

2011-03-30
Array ( [0] => 30/3 [1] => 31/3 [2] => 1/4 [3] => 2/4 [4] => 3/4 [5] => 3/4 [6] => 4/4 )

2011-03-31
Array ( [0] => 31/3 [1] => 1/4 [2] => 2/4 [3] => 3/4 [4] => 3/4 [5] => 4/4 [6] => 5/4 )

2011-04-01
Array ( [0] => 1/4 [1] => 2/4 [2] => 3/4 [3] => 3/4 [4] => 4/4 [5] => 5/4 [6] => 6/4 )

2011-04-02
Array ( [0] => 2/4 [1] => 3/4 [2] => 3/4 [3] => 4/4 [4] => 5/4 [5] => 6/4 [6] => 7/4 )

2011-04-03
Array ( [0] => 3/4 [1] => 3/4 [2] => 4/4 [3] => 5/4 [4] => 6/4 [5] => 7/4 [6] => 8/4 )

Now it display correctly
2011-04-04
Array ( [0] => 4/4 [1] => 5/4 [2] => 6/4 [3] => 7/4 [4] => 8/4 [5] => 9/4 [6] => 10/4 )

and so on....

If I do the same demo using 2012 I get the same incorrect results but the day that is duplicated is moved up by two. So it must not have to do with leap years at all. Something in my PHP version must be screwy. Look at this result

2012-03-28
Array ( [0] => 28/3 [1] => 29/3 [2] => 30/3 [3] => 31/3 [4] => 1/4 [5] => 1/4 [6] => 2/4 )

and
2012-03-29
Array ( [0] => 29/3 [1] => 30/3 [2] => 31/3 [3] => 1/4 [4] => 1/4 [5] => 2/4 [6] => 3/4 )

My PHP Info:
PHP Version 5.3.6-13ubuntu3.2

0
 
Mark BradyPrincipal Data EngineerAuthor Commented:
Sorry, I mean the day jumps DOWN by 2. 2011 repeats 3rd of March (3/4) and 2011 repeats 1/4.
0
 
Mark BradyPrincipal Data EngineerAuthor Commented:
Ray have you tried changing your timezone to New Zealand? We are in daylight savings time right now so it may give different results. Change your timezone from
date_default_timezone_set('America/Chicago');

To

date_default_timezone_set('Antarctica/McMurdo');

See if you still get the correct results?
0
 
Mark BradyPrincipal Data EngineerAuthor Commented:
When I use my function but change my timezone to America/Chicago then my dates display the correct way. Must be something to do with daylight savings time.
0
 
Ray PaseurCommented:
Mark:  Here's another take on it.  See if this link gives you the kind of output you need.
http://www.laprbass.com/RAY_temp_elvin66.php

Best regards and Merry Christmas, ~Ray
<?php // RAY_temp_elvin66.php
error_reporting(E_ALL);
echo "<pre>";

// ABOUT LEAP YEAR
// http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_201-Handling-date-and-time-in-PHP-and-MySQL.html

// REQUIRED
date_default_timezone_set('America/Chicago');


// ANOTHER TAKE
function RAY_dates($alpha='Today', $ndays=7)
{
    $alpha_ts = strtotime($alpha);
    if (!$alpha_ts) return FALSE;
    $omega = date('c', $alpha_ts) . " + $ndays DAYS";
    $omega_ts = strtotime($omega);
    if (!$omega_ts) return FALSE;
    while ($alpha_ts < $omega_ts)
    {
        $alpha_ts = $alpha_ts + 24*60*60;
        $array[] = date('Y-m-d', $alpha_ts);

    }
    return $array;
}
print_r(ray_dates());
print_r(ray_dates('March 28, 2011'));
print_r(ray_dates('March 28, 2012'));

// OVER NON-LEAP YEAR
print_r(ray_dates('February 26, 2011', 5));

// OVER LEAP YEAR
print_r(ray_dates('February 26, 2012', 5));

Open in new window

0
 
Mark BradyPrincipal Data EngineerAuthor Commented:
Thanks Ray. Yes that displays correctly. What I need to know is I want you to display 7 days starting from 2011-03-30 - just the month and the day is ok. So you should get results like this

Array (
[0] => 30/3
[1] => 31/3
[2] => 1/4
[3] => 2/4
[4] => 3/4
[5] => 4/4
[6] => 5/4 )

Which is correct. But I want you to set your timezone to New Zealand first. ('Pacific/Auckland')

If I use my function with the timezone set to Chicago like you, it displays correctly,, but when I change it it Pacific/Auckland, it throws in an extra day for some reason due to our daylight savings time and I was wondering it it is a bug in PHP. I know your way is a better/more correct way to display these dates and I will change my function to use your way, but I am trying to find out why my function is failing when my timezone is set to Pacific/Auckland. I thought it was due to the leap year but if gives bad results in 2011 as well which is not a leap year so I figure it is daylight savings that is causing the issue? What are your thoughts on this and why are you working when you should be out in the swimming pool with a margarita in your hand!
0
 
Ray PaseurCommented:
Seems OK for your timezone.
http://www.laprbass.com/RAY_temp_elvin66_2.php
<?php // RAY_temp_elvin66_2.php
error_reporting(E_ALL);
echo "<pre>";

// ABOUT LEAP YEAR
// http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_201-Handling-date-and-time-in-PHP-and-MySQL.html

// REQUIRED
date_default_timezone_set('Antarctica/McMurdo');


// ANOTHER TAKE
function RAY_dates($alpha='Today', $ndays=7)
{
    $alpha_ts = strtotime($alpha);
    if (!$alpha_ts) return FALSE;
    $omega = date('c', $alpha_ts) . " + $ndays DAYS";
    $omega_ts = strtotime($omega);
    if (!$omega_ts) return FALSE;
    while ($alpha_ts < $omega_ts)
    {
        $alpha_ts = $alpha_ts + 24*60*60;
        $array[] = date('Y-m-d', $alpha_ts);

    }
    return $array;
}
print_r(ray_dates());
print_r(ray_dates('March 28, 2011'));
print_r(ray_dates('March 28, 2012'));

// OVER NON-LEAP YEAR
print_r(ray_dates('February 26, 2011', 5));

// OVER LEAP YEAR
print_r(ray_dates('February 26, 2012', 5));

Open in new window

0
 
Ray PaseurCommented:
This works, too.
http://www.laprbass.com/RAY_temp_elvin66_3.php

I do not really understand why your code works the way it does.  And I am not very good at debugging code, so I try to stick to patterns that I know work correctly.  And it's a little chilly in Washington, DC at Christmas time so that would explain why I am not in my backyard at my swimming pool.

But that part about the Margarita sounds pretty good!
<?php // RAY_temp_elvin66_3.php
error_reporting(E_ALL);
echo "<pre>";

// ABOUT LEAP YEAR
// http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_201-Handling-date-and-time-in-PHP-and-MySQL.html

// REQUIRED
date_default_timezone_set('Pacific/Auckland');


// ANOTHER TAKE
function RAY_dates($alpha='Today', $ndays=7)
{
    $alpha_ts = strtotime($alpha);
    if (!$alpha_ts) return FALSE;
    $omega = date('c', $alpha_ts) . " + $ndays DAYS";
    $omega_ts = strtotime($omega);
    if (!$omega_ts) return FALSE;
    while ($alpha_ts < $omega_ts)
    {
        $alpha_ts = $alpha_ts + 24*60*60;
        $array[] = date('j/n', $alpha_ts);

    }
    return $array;
}
print_r(ray_dates());
print_r(ray_dates('March 28, 2011'));
print_r(ray_dates('March 28, 2012'));

// OVER NON-LEAP YEAR
print_r(ray_dates('February 26, 2011'));

// OVER LEAP YEAR
print_r(ray_dates('February 26, 2012'));

Open in new window

0
 
Mark BradyPrincipal Data EngineerAuthor Commented:
Hmmm ok that's interesting. Oh by the way, they seem to have added a specific timezone for Auckland, New Zealand now. We used to use Antarctica/McMurdo but now we can use 'Pacific/Auckland' which is more appropriate. McMurdo is way south of Auckland (That is at the south pole) and Auckland is quite high up the country in the North Island, however we only have one timezone in New Zealand cause we are so small. Once you get to Australia they have different states/Territories and timezones.

Any thoughts on why my function is failing? I'm not going to beat this to death, I will use your function but I am interested in the logic of why my one fails with daylight savings time.
0
 
Mark BradyPrincipal Data EngineerAuthor Commented:
Ahh yes I see - it is nice and warm over here and the sun is beating down. In any case thanks for the new function.

Hey wait a minute! I just noticed the latest post with your results. The 2nd and 3rd result set is incorrect!

Array
(
    [0] => 29/3
    [1] => 30/3
    [2] => 31/3
    [3] => 1/4
    [4] => 2/4
    [5] => 3/4
    [6] => 3/4
)
Array
(
    [0] => 29/3
    [1] => 30/3
    [2] => 31/3
    [3] => 1/4
    [4] => 1/4
    [5] => 2/4
    [6] => 3/4
)

It is repeating dates. Did you notice that?
0
 
Mark BradyPrincipal Data EngineerAuthor Commented:
print_r(ray_dates('March 28, 2011'));
print_r(ray_dates('March 28, 2012'));

Both show and extra date (double up.)
I notice your function adds one day to the dates you send it before displaying the results. You feed it March 28 and the results start on March 29.
0
 
Ray PaseurCommented:
I may have an idea.  When does daylight savings time end?
0
 
Mark BradyPrincipal Data EngineerAuthor Commented:
Here is what our internal affairs department says about our daylight savings.

Daylight Saving commences on the last Sunday in September, when 2.00am becomes 3.00am, and it ends on the first Sunday in April, when 3.00am becomes 2.00am.
0
 
Mark BradyPrincipal Data EngineerAuthor Commented:
Aha!!! Looks like April 1st when it ends is the problem.
0
 
Mark BradyPrincipal Data EngineerAuthor Commented:
It changes each year. Below is the start and end dates for each year.
2011      3 April      25 September
2012      1 April      30 September
2013      7 April      29 September
2014      6 April      28 September
2015      5 April      27 September
2016      3 April      25 September
2017      2 April      24 September
2018      1 April      30 September
2019      7 April      29 September
2020      5 April      27 September

Looks like PHP has not taken into account New Zealands whacky Daylight Savings times perhaps?
0
 
Dave BaldwinFixer of ProblemsCommented:
Here's a version with both local and NZ timezones and a form to enter a new start date.  The problem appears to be with April 3rd in the "Pacific/Auckland" zone.  I tried a couple of other Pacific zones and they were alright.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<title>PHP Date List</title>
</head>
<body>
<h1>PHP Date List</h1>
<?php 
$nxtdate = "2011-03-30";
if(isset($_POST['submit'])) {
	$nxtdate = $_POST['nxtdate'];
	}

function setDates($strtm1){

// Set mysql start date TS for day 1
$m = date('n', strtotime($strtm1));
$d = date('j', strtotime($strtm1));
$y = date('y', strtotime($strtm1));
$startDateTS = mktime(0,0,0,$m,$d,$y);
for($x=0;$x<7;$x++)
      {
      $counter = $x;
      $miniDateHeader[$x] = date('j/n', $startDateTS + ($counter * 86400));
      }
      return $miniDateHeader;
}
date_default_timezone_set('America/Los_Angeles');
$dateArray = setDates($nxtdate);
echo "US: ";
print_r($dateArray);
echo "<br>NZ: ";
date_default_timezone_set('Pacific/Auckland');
$dateArray = setDates($nxtdate);
print_r($dateArray);
 ?>
<form action="#" method="post">
Next Date: <input type="text" name="nxtdate" value="<?php echo $nxtdate; ?>" /><br>
<input type="submit" name="submit" value="Submit" />
</form>
</body>
</html>

Open in new window

0
 
Ray PaseurCommented:
This page describes where to get the latest from PECL.  I wish it also told us who to complain to!
http://php.net/manual/en/timezones.php
0
 
Ray PaseurCommented:
Here is why I suspect a bug.
http://www.laprbass.com/RAY_temp_elvin66_4.php
<?php // RAY_temp_elvin66_4.php
error_reporting(E_ALL);
echo "<pre>";

// ABOUT LEAP YEAR
// http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_201-Handling-date-and-time-in-PHP-and-MySQL.html

// REQUIRED
date_default_timezone_set('Pacific/Auckland');


// ANOTHER TAKE
function RAY_dates($alpha='Today', $ndays=7)
{
    // VALIDATE THE START AND STOP TIMESTAMPS
    $alpha_ts = strtotime($alpha);
    if (!$alpha_ts) return FALSE;
    $omega = date('c', $alpha_ts) . " + $ndays DAYS";
    $omega_ts = strtotime($omega);
    if (!$omega_ts) return FALSE;

    // SET ISO-8601 DATES FROM THE TIMESTAMPS
    $alpha = date('c', $alpha_ts);
    $omega = date('c', $omega_ts);

    while ($alpha < $omega)
    {
        // ADD ONE DAY
        $alpha_ts = strtotime($alpha . ' + 1 DAY');
        $alpha    = date('c', $alpha_ts);

        // RECOVER THE RETURN VALUES STRING
        $array[]  = date('c', $alpha_ts) . ' if DST, = 1 here: ' . date('I', $alpha_ts);

    }
    return $array;
}
print_r(ray_dates());
print_r(ray_dates('March 28, 2011'));
print_r(ray_dates('March 28, 2012'));

// OVER NON-LEAP YEAR
print_r(ray_dates('February 26, 2011'));

// OVER LEAP YEAR
print_r(ray_dates('February 26, 2012'));

Open in new window

0
 
Dave BaldwinFixer of ProblemsCommented:
Ray, on your page, the 'duplicate dates' actually show the time and the time-offset changing.  If you set it to "America/Los_Angeles", they change also but in a positive direction.

I modified the code to use the time also (12:00:00 default)... and the 'problem' goes away.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<title>PHP Date List</title>
</head>
<body>
<h1>PHP Date List</h1>
<?php 
$nxtdate = "2011/03/30 12:00:00";
if(isset($_POST['submit'])) {
	$nxtdate = $_POST['nxtdate'];
	}

function setDates($strtm1){

// Set mysql start date TS for day 1
$m = date('n', strtotime($strtm1));
$d = date('j', strtotime($strtm1));
$y = date('y', strtotime($strtm1));
$H = date('H', strtotime($strtm1));
$i = date('i', strtotime($strtm1));
$s = date('s', strtotime($strtm1));
$startDateTS = mktime($H,$i,$s,$m,$d,$y);
for($x=0;$x<7;$x++)
      {
      $counter = $x;
      $miniDateHeader[$x] = date('j/n', $startDateTS + ($counter * 86400));
      }
      return $miniDateHeader;
}
date_default_timezone_set('America/Los_Angeles');
$dateArray = setDates($nxtdate);
echo "US: ";
print_r($dateArray);
echo "<br>NZ: ";
date_default_timezone_set('Pacific/Auckland');
$dateArray = setDates($nxtdate);
print_r($dateArray);
 ?>
<form action="#" method="post">
Next Date: <input type="text" name="nxtdate" value="<?php echo $nxtdate; ?>" /><br>
<input type="submit" name="submit" value="Submit" />
</form>
</body>
</html>

Open in new window

<?php // RAY_temp_elvin66_3.php
error_reporting(E_ALL);
echo "<pre>";

// ABOUT LEAP YEAR
// http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_201-Handling-date-and-time-in-PHP-and-MySQL.html

// REQUIRED
date_default_timezone_set('Pacific/Auckland');
//date_default_timezone_set('Asia/Tokyo');


// ANOTHER TAKE
function RAY_dates($alpha='Today', $ndays=7)
{
    // VALIDATE THE START AND STOP TIMESTAMPS
    $alpha_ts = strtotime($alpha);
    if (!$alpha_ts) return FALSE;
    $omega = date('c', $alpha_ts) . " + $ndays DAYS";
    $omega_ts = strtotime($omega);
    if (!$omega_ts) return FALSE;

    // SET ISO-8601 DATES FROM THE TIMESTAMPS
    $alpha = date('c', $alpha_ts);
    $omega = date('c', $omega_ts);

    while ($alpha < $omega)
    {
        // ADD ONE DAY
        $alpha_ts = strtotime($alpha . ' + 1 DAY');
        $alpha    = date('c', $alpha_ts);

        // RECOVER THE RETURN VALUES STRING
        $array[]  = date('c', $alpha_ts);

    }
    return $array;
}
print_r(ray_dates());
print_r(ray_dates('March 30, 2011 12:00:00'));
print_r(ray_dates('March 30, 2012 12:00:00'));

// OVER NON-LEAP YEAR
print_r(ray_dates('February 26, 2011 12:00:00'));

// OVER LEAP YEAR
print_r(ray_dates('February 26, 2012 12:00:00'));

Open in new window

0
 
Mark BradyPrincipal Data EngineerAuthor Commented:
Interesting. But if you enter a MYSQL formatted date into your modified function Dave, it fails again.

Try your function but change the function calls to this

print_r(ray_dates('2011-03-30')); // repeats 04/03
print_r(ray_dates('2012-03-30')); // repeats 04/01

Strange huh!
0
 
Dave BaldwinFixer of ProblemsCommented:
You missed the point.  What you're seeing is the fact that Daylight Savings Time is causing an offset that is not taken into account by your code.  If you use '2011-03-30 12:00:00' you will get the 'correct' days.  PHP and MySQL date formats are really date-and-time formats.  There is no 'date only' format.  '2011-03-30' is really '2011-03-30 00:00:00'.  

If you look at Ray's original page, you will see the time and time-offsets change on those dates in a way that changes the apparent date.  But because of DST, it is still a correct 24 hours (86400 seconds) later.  If you add the time '12:00:00' to the input dates, it still changes but since it's in the middle of the day, the misleading 'wrong' day doesn't show up.
0
 
Dave BaldwinFixer of ProblemsCommented:
A simple 'fix' would be to just make it reference noon on whatever day is input.

$startDateTS = mktime(12,0,0,$m,$d,$y);
0
 
Mark BradyPrincipal Data EngineerAuthor Commented:
Making the hour 12pm solves my problem - Thanks Dave. Thanks heaps to both of you for persisting with this thing. I still believe php have a bug after reading the existing bug reports on this subject however as long as I can get my stuff working I'm happy and I will be mindful in the future of functions around daylight saving time in this timezone now. Thanks again guys and have a great Christmas! Ray, get that Margarita poured buddy!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.