/** * Cache datetime generation and convert to db format * Based on xhprof data, this operation in time consuming, so we need to cache that * * @return mixed */ function getConvertDatetime() { static $datetime = ''; self::$datetimeCacheIndex++; if (self::$datetimeCacheIndex > self::$datetimeIndexMax || empty($datetime)) { $datetime = $GLOBALS['db']->convert("'" . date('Y-m-d H:i:s') . "'", 'datetime'); self::$datetimeCacheIndex = 0; } return $datetime; }