get previous date (MY_date_helper.php)

intsurfer edited this page Jul 15, 2012 · 1 revision
Clone this wiki locally
/**
 * Get previous date for mysql format date
 * by Nick Gorbunov
 *
 * @access    public
 * @param    string '2012-07-25'
 * @return    string '2012-07-24'
 */ 
 if (!function_exists('getPrevDate')) {
function getPrevDate($dat) {
	date_default_timezone_set('Europe/Moscow');
	list($yyyy, $mm, $dd) = explode("-", $dat);
	$d = mktime(0, 0, 0, $mm, $dd, $yyyy) - 24 * 60 * 60;
	list($dd, $tt) = explode(" ", unix_to_human($d, TRUE, 'eu'));
	return $dd;
}

}