app_timezone example

if (function_exists('now')) {
    /** * Get "now" time * * Returns Time::now()->getTimestamp() based on the timezone parameter or on the * app_timezone() setting * * @throws Exception */
    function now(?string $timezone = null): int
    {
        $timezone = empty($timezone) ? app_timezone() : $timezone;

        if ($timezone === 'local' || $timezone === date_default_timezone_get()) {
            return Time::now()->getTimestamp();
        }

        $time = Time::now($timezone);
        sscanf(
            $time->format('j-n-Y G:i:s'),
            '%d-%d-%d %d:%d:%d',
            $day,
            $month,
            

    public static function display(): array
    {
        $config = config(App::class);

        return [
            'ciVersion'   => CodeIgniter::CI_VERSION,
            'phpVersion'  => PHP_VERSION,
            'phpSAPI'     => PHP_SAPI,
            'environment' => ENVIRONMENT,
            'baseURL'     => $config->baseURL,
            'timezone'    => app_timezone(),
            'locale'      => Services::request()->getLocale(),
            'cspEnabled'  => $config->CSPEnabled,
        ];
    }
}
Home | Imprint | This part of the site doesn't use cookies.