Question about date comparisons

When I run the following code, I get a UNIX timestamp for debugFeaturesLaunch, but not debugFeaturesLogin. Can someone see what I am obviously overlooking?

Thanks!


// $_SESSION[lastLogin] uses dates in the format of 01-30-2012

$lastLogin = strtotime($_SESSION[lastLogin]);
$_SESSION[debugFeaturesLogin] = $lastLogin;

$launchDate  = "07-01-2012";
$launchDate = strtotime($launchDate);
$_SESSION[debugFeaturesLaunch] = $launchDate;

if ($lastLogin < $launchDate) {
    $campaign = "Features";
    $_SESSION[viewedCampaignToday] = "Yes";
}

what does


var_dump($_SESSION[lastLogin]);

say?

make some others var_dump lines to check your values.

according to me, the strtotime() accept the English date format as in its manual, i look around the web for English date format most of them exclude the mm-dd-yyyy format.otherwise this function works well most of the time.

What rajeev is saying is actually probably your problem:

// $_SESSION[lastLogin] uses dates in the format of 01-30-2012

xx-yy-zzzz is interpreted as dd-mm-yyyy ; there is no Month 30.

Reformat your string as xx/yy/zzzz to invoke the American interpretation of mm/dd/yyyy