/** * This function is used to change the date into database format with offset. * @param Date $orgDate = date to be changed. * @return Date Formatted date. */ public static function getGMTformatdate($orgDate) { $gmtOffset = sapp_Global::_getGlobalOffset(); $orgDateInSec = strtotime($orgDate); $offsetInMin = sapp_Global::hoursToMinutes($gmtOffset); $gmtOffsetInSec = $offsetInMin * 60; $totalOrgDate = $orgDateInSec + $gmtOffsetInSec; $finalDateTime = date('Y-m-d', $totalOrgDate); return $finalDateTime; }