I observed that CakePHP treats tinyint fields as boolean (true/false) , but after investigation found that: if you set the data type for a field to tinyint with length of 1, then CakePHP will treat it as boolean. So I changed it to tinyint(2), That's weird about CakePHP
Month: September 2012
How to calculate the result of a mathematical expression given as a string: function calc_string( $mathString ) { $cf_DoCalc = create_function("", "return (" . $mathString . ");" ); return $cf_DoCalc(); } echo "result is: "calc_string("2+25*3"); //result is: 77
To check client URL (cURL) is enabled or not you can simply: if (in_array ('curl', get_loaded_extensions())) { return true; } else{ return false; }
Date.daysBetween = function( date1, date2 ) { //Get 1 day in milliseconds var one_day=1000*60*60*24; // Convert both dates to milliseconds var date1_ms = date1.getTime(); var date2_ms = date2.getTime(); // Calculate the difference in milliseconds var difference_ms = date2_ms - date1_ms; // Convert back to days and return return Math.round(difference_ms/one_day); } //date1 and date2 are Date … Continue reading Javascript: Easily calculate difference between two dates in days