X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=includes%2Fdate_functions.inc;h=13294eb055721b8653cba1b9208f24765727554a;hb=b3364aceecbf38109924c6ee1d48a28db78ad725;hp=c681353109eb44ae7548d706fd3b3d0f3e92c3e5;hpb=d567a10b7925c8bb97c734e213d6651a979af29d;p=fa-stable.git diff --git a/includes/date_functions.inc b/includes/date_functions.inc index c6813531..13294eb0 100644 --- a/includes/date_functions.inc +++ b/includes/date_functions.inc @@ -13,11 +13,13 @@ date validation and parsing functions These functions refer to the global variable defining the date format -The date format is defined in config.php called DefaultDateFormat +The date format is defined in config.php called dateformats this can be a string either "d/m/Y" for UK/Australia/New Zealand dates or -"m/d/Y" for US/Canada format dates +"m/d/Y" for US/Canada format dates depending on setting in preferences. */ +if(function_exists("date_default_timezone_set") && function_exists("date_default_timezone_get")) + @date_default_timezone_set(@date_default_timezone_get()); function __date($year, $month, $day) { @@ -141,6 +143,19 @@ function Now() else return date("H:i"); } +// +// Retrieve and optionaly set default date for new document. +// +function new_doc_date($date=null) +{ + if (isset($date)) + $_SESSION['_default_date'] = $date; + + if (!isset($_SESSION['_default_date']) || !sticky_doc_date()) + $_SESSION['_default_date'] = Today(); + + return $_SESSION['_default_date']; +} function is_date_in_fiscalyear($date, $convert=false) { @@ -347,9 +362,11 @@ and converts to a yyyy/mm/dd format */ $year = substr($date_,0,4); } } + else + $year = $month = $day = 0; //to modify assumption in 2030 - if ($date_system == 0) + if ($date_system == 0 || $date_system == 3) { if ((int)$year < 60) { @@ -403,7 +420,7 @@ function date1_greater_date2 ($date1, $date2) } -function date_diff ($date1, $date2, $period) +function date_diff2 ($date1, $date2, $period) { /* expects dates in the format specified in $DefaultDateFormat - period can be one of 'd','w','y','m'