当前位置: 首页>>代码示例>>PHP>>正文


PHP date_default_timezone_set函数代码示例

本文整理汇总了PHP中date_default_timezone_set函数的典型用法代码示例。如果您正苦于以下问题:PHP date_default_timezone_set函数的具体用法?PHP date_default_timezone_set怎么用?PHP date_default_timezone_set使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了date_default_timezone_set函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct($name = null, array $data = array(), $dataName = '')
 {
     $this->_className = $name;
     $this->_root = dirname(__FILE__);
     date_default_timezone_set('UTC');
     parent::__construct($name, $data, $dataName);
 }
开发者ID:hjr3,项目名称:zf2,代码行数:7,代码来源:TestCommonBackend.php

示例2: initialize

 /**
  * Initialize the provider
  *
  * @return void
  */
 public function initialize()
 {
     $this->options = array_merge($this->defaultConfig, $this->options);
     date_default_timezone_set($this->options['log.timezone']);
     // Finally, create a formatter
     $formatter = new LineFormatter($this->options['log.outputformat'], $this->options['log.dateformat'], false);
     // Create a new directory
     $logPath = realpath($this->app->config('bono.base.path')) . '/' . $this->options['log.path'];
     if (!is_dir($logPath)) {
         mkdir($logPath, 0755);
     }
     // Create a handler
     $stream = new StreamHandler($logPath . '/' . date($this->options['log.fileformat']) . '.log');
     // Set our formatter
     $stream->setFormatter($formatter);
     // Create LogWriter
     $logger = new LogWriter(array('name' => $this->options['log.name'], 'handlers' => array($stream), 'processors' => array(new WebProcessor())));
     // Bind our logger to Bono Container
     $this->app->container->singleton('log', function ($c) {
         $log = new Log($c['logWriter']);
         $log->setEnabled($c['settings']['log.enabled']);
         $log->setLevel($c['settings']['log.level']);
         $env = $c['environment'];
         $env['slim.log'] = $log;
         return $log;
     });
     // Set the writer
     $this->app->config('log.writer', $logger);
 }
开发者ID:krisanalfa,项目名称:b-comp,代码行数:34,代码来源:LogProvider.php

示例3: getDate

 function getDate()
 {
     $timezone = 'Asia/Manila';
     date_default_timezone_set($timezone);
     $timeNow = date("m-d-Y-hia");
     return $timeNow;
 }
开发者ID:roothub,项目名称:dslweb,代码行数:7,代码来源:Documents.php

示例4: __construct

 public function __construct($filepath, $timezone, $priority)
 {
     if ($priority == PhpLog::OFF) {
         return;
     }
     $this->filename = date('Y-m-d', time()) . '.log';
     $this->log_file = $this->createPath($filepath, $this->filename);
     $this->MessageQueue = array();
     $this->priority = $priority;
     date_default_timezone_set($timezone);
     if (!file_exists($filepath)) {
         if (!empty($filepath)) {
             if (!$this->_createDir($filepath)) {
                 die("创建目录失败!");
             }
             if (!is_writable($this->log_file)) {
                 $this->Log_Status = PhpLog::OPEN_FAILED;
                 $this->MessageQueue[] = "The file exists, but could not be opened for writing. Check that appropriate permissions have been set.";
                 return;
             }
         }
     }
     if ($this->file_handle = fopen($this->log_file, "a+")) {
         $this->Log_Status = PhpLog::LOG_OPEN;
         $this->MessageQueue[] = "The log file was opened successfully.";
     } else {
         $this->Log_Status = PhpLog::OPEN_FAILED;
         $this->MessageQueue[] = "The file could not be opened. Check permissions.";
     }
     return;
 }
开发者ID:zhang19960118,项目名称:html11,代码行数:31,代码来源:log.class.php

示例5: addCompanyDetails

function addCompanyDetails()
{
    $userID = trim($_REQUEST['userID']);
    $companyName = trim($_REQUEST['companyName']);
    //Get Request From Device
    $companyTanNo = trim($_REQUEST['companyTanNo']);
    $companyPanNo = trim($_REQUEST['companyPanNo']);
    $companyAddress = trim($_REQUEST['companyAddress']);
    $rm = new Response_Methods();
    if ($companyName == "" || $companyTanNo == "" || $companyPanNo == "" || $companyAddress == "") {
        $result = $rm->fields_validation();
        return $result;
    } else {
        date_default_timezone_set('Asia/Calcutta');
        $createdDate = date('Y-m-d H:i:s');
        $getList = array();
        $getFieldValue['login_user_id'] = $userID;
        $getFieldValue['company_name'] = $companyName;
        $getFieldValue['company_tan_no'] = $companyTanNo;
        $getFieldValue['company_pan_no'] = $companyPanNo;
        $getFieldValue['company_address'] = $companyAddress;
        $getFieldValue['company_created_date'] = $createdDate;
        $lastInsertId = $rm->insert_record($getFieldValue, 'company_details_t');
        if (!empty($lastInsertId)) {
            $result = $rm->companyRegisterSuccessJson($lastInsertId);
            return $result;
        } else {
            $result = $rm->companyRegisterFailJson();
            return $result;
        }
    }
}
开发者ID:Kavitapsawant,项目名称:Axis-Group,代码行数:32,代码来源:addCompanyDetails.php

示例6: Header

 function Header()
 {
     $this->Print_Logo();
     $this->SetDrawColor(0);
     $this->SetLineWidth(0);
     $this->SetXY($this->margenDerecho, 10);
     $this->SetFont('Arial', 'B', 16);
     $this->Cell(0, 0, 'Datos de la Empresa', 0, 0, 'C');
     $psiniestro = $_SESSION["ReportesSiniestros"]["ID"];
     $porden = $_SESSION["ReportesSiniestros"]["ORDEN"];
     $this->SetFont('Arial', "I", 6);
     //$ahora = ["FECHASERVER"];
     date_default_timezone_set('UTC');
     $this->SetXY(5, 5);
     $ahora = date("d/m/Y");
     $this->Cell(0, 0, $ahora . "  ", 0, 0, 'L');
     $this->Ln(15);
     $this->SetX($this->margenDerecho);
     $this->RellenaFondoLinea(192, 192, 192);
     /*
     	$this->SetFillColor(192, 192, 192);
     	$x=$this->GetX();
     	$y=$this->GetY();
     	$anchofijo = $this->w - 15;
     	$this->Rect($x, $y+0.2, $anchofijo, 5, "F");
     	$this->SetFillColor(0, 0, 0);
     */
     $this->SetTextColor(0, 0, 0);
     $this->SetFontAlignGeneral();
     $Newrow = array_values($this->arrayTitulos);
     $this->Row($Newrow);
     // $this->LineaSepara();
     $this->Ln(5);
 }
开发者ID:javierlov,项目名称:FuentesWeb,代码行数:34,代码来源:ReporteDatosdelaEmpresa.php

示例7: __construct

 public function __construct()
 {
     parent::__construct();
     $this->load->helper('date');
     $this->load->model('mod_farmersprofile');
     date_default_timezone_set("Asia/Kathmandu");
 }
开发者ID:sahaz,项目名称:Hamro_Krishi,代码行数:7,代码来源:login_controller.php

示例8: timestampToDateTime

 public function timestampToDateTime($timestamp)
 {
     date_default_timezone_set("UTC");
     $date = new \DateTime();
     $date->setTimestamp($timestamp);
     return $date;
 }
开发者ID:jdf221,项目名称:Pheddit,代码行数:7,代码来源:Object.php

示例9: index

    public function index($ss){
        $data2=$this->mdiem_danh->mdiem_danh_select($ss);
        $name = $this->input->post("sex");
        date_default_timezone_set('Asia/Ho_Chi_Minh');
        $d=date('Y-m-d');
        $t=date('H:i:s');
        if($this->input->post('submit') == "submit"){

            $data=$this->mdiem_danh->mdiem_danh_check_time($d);
            if($data==0){
                    if(isset($name)&& $name=='online')
                        $this->mdiem_danh->mdiem_danh_insert($d,$t,$ss);
                        echo "Diem danh thanh cong";
            }else{
                    if(isset($name)&& $name=='offline'){
                        $this->mdiem_danh->mdiem_danh_update($t,$d);
                        echo "ban da offline";
                    }else{
                        echo "ko dc diem danh";
                    }
            }
        }

        $data1 = array(
            'test' => $data2,
        );

        $this->load->view('view_diem_danh',$data1);

    }
开发者ID:hoangductho,项目名称:Gravtivy-Start-Project,代码行数:30,代码来源:diemdanh.php

示例10: make_discount

 function make_discount($cpn_code, $total_amt, $tp_id, $std_id)
 {
     date_default_timezone_set('Asia/Calcutta');
     $this->select("coupons", "id, discount, exp_date, used_by", "name='{$cpn_code}'", "none", "1");
     if ($this->sel_count_row > 0) {
         $discount = $this->select_res['discount'];
         $new_amt = $total_amt - $discount;
         $exp_date_arr = explode("-", $this->select_res['exp_date']);
         $exp_time = mktime(0, 0, 0, $exp_date_arr[2], $exp_date_arr[1], $exp_date_arr[0]);
         $crnt_time = time();
         if ($exp_time > $crnt_time) {
             $cpn_id = $this->select_res['id'];
             if ($this->select_res['used_by'] != "") {
                 $old_reciver = json_decode($this->select_res['used_by'], true);
                 $old_reciver[] = array('std_id' => $std_id, 'tp_id' => $tp_id);
                 $new_reciver = json_encode($old_reciver);
             } else {
                 $new_reciver = json_encode(array(array('std_id' => $std_id, 'tp_id' => $tp_id)));
             }
             $this->update("coupons", "used_by='{$new_reciver}'", "id='{$cpn_id}'", "1");
             return $new_amt;
         } else {
             return $total_amt;
         }
     } else {
         return $total_amt;
     }
 }
开发者ID:jstoppo,项目名称:pazlet.com,代码行数:28,代码来源:coupons.class.php

示例11: __construct

 public function __construct()
 {
     parent::__construct();
     // Your own constructor code
     date_default_timezone_set('Asia/Manila');
     $this->load->model('site_model');
 }
开发者ID:astigino,项目名称:smartcook-orig,代码行数:7,代码来源:site.php

示例12: buat_SEP

 public function buat_SEP()
 {
     $timezone = date_default_timezone_get();
     date_default_timezone_set('UTC');
     $timestamp = strval(time() - strtotime('1970-01-01 00:00:00'));
     //cari timestamp
     $signature = hash_hmac('sha256', '27952' . '&' . $timestamp, 'rsm32h1', true);
     $encoded_signature = base64_encode($signature);
     $http_header = array('Accept: application/json', 'Content-type: application/xml', 'X-cons-id: 27952', 'X-timestamp: ' . $timestamp, 'X-signature: ' . $encoded_signature);
     date_default_timezone_set($timezone);
     //nama variabel sesuai dengan nama di xml
     $noMR = $this->input->post('no_cm');
     $noKartu = $this->input->post('no_bpjs');
     $noRujukan = $this->input->post('no_sjp');
     $ppkRujukan = $this->input->post('ppk_rujukan');
     $jnsPelayanan = $this->input->post('pelayanan');
     $klsRawat = $this->input->post('kelas_pasien');
     $diagAwal = $this->input->post('nm_diagnosa');
     $poliTujuan = $this->input->post('nm_poli');
     $catatan = $this->input->post('catatan');
     $user = 'Administrator';
     $ppkPelayanan = '0601R001';
     $tglSep = date('Y-m-d H:i:s');
     $tglRujukan = date('Y-m-d H:i:s');
     $data = '<request><data><t_sep>' . '<noKartu>' . $noKartu . '</noKartu>' . '<tglSep>' . $tglSep . '</tglSep>' . '<tglRujukan>' . $tglRujukan . '</tglRujukan>' . '<noRujukan>' . $noRujukan . '</noRujukan>' . '<ppkRujukan>' . $ppkRujukan . '</ppkRujukan>' . '<ppkPelayanan>' . $ppkPelayanan . '</ppkPelayanan>' . '<jnsPelayanan>' . $jnsPelayanan . '</jnsPelayanan>' . '<catatan>' . $catatan . '</catatan>' . '<diagAwal>' . $diagAwal . '</diagAwal>' . '<poliTujuan>' . $poliTujuan . '</poliTujuan>' . '<klsRawat>' . $klsRawat . '</klsRawat>' . '<user>' . $user . '</user>' . '<noMR>' . $noMR . '</noMR>' . '</t_sep></data></request>';
     $ch = curl_init('http://api.asterix.co.id/SepWebRest/sep/create/');
     curl_setopt($ch, CURLOPT_POST, true);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
     curl_setopt($ch, CURLOPT_HTTPHEADER, $http_header);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     $result = curl_exec($ch);
     curl_close($ch);
     $sep = json_decode($result)->response;
     echo $sep;
 }
开发者ID:mahdidham,项目名称:rsbpjs,代码行数:35,代码来源:Ajax.php

示例13: initialize

 /**
  * @param string $type The type of init to load, possible values are: frontend, frontend_ajax, frontend_js.
  */
 public function initialize($type)
 {
     $type = (string) $type;
     // check if this is a valid type
     if (!in_array($type, $this->allowedTypes)) {
         exit('Invalid init-type');
     }
     $this->type = $type;
     // set a default timezone if no one was set by PHP.ini
     if (ini_get('date.timezone') == '') {
         date_default_timezone_set('Europe/Brussels');
     }
     // get last modified time for globals
     $lastModifiedTime = @filemtime(PATH_WWW . '/app/config/parameters.yml');
     // reset last modified time if needed when invalid or debug is active
     if ($lastModifiedTime === false || $this->getContainer()->getParameter('kernel.debug')) {
         $lastModifiedTime = time();
     }
     // define as a constant
     defined('LAST_MODIFIED_TIME') || define('LAST_MODIFIED_TIME', $lastModifiedTime);
     $this->definePaths();
     $this->defineURLs();
     $this->setDebugging();
     // require spoon
     require_once 'spoon/spoon.php';
 }
开发者ID:arashrasoulzadeh,项目名称:forkcms,代码行数:29,代码来源:Init.php

示例14: change_channel

function change_channel($change_channel)
{
    $ret = false;
    if ($change_channel) {
        $r = q("select channel.*, xchan.* from channel left join xchan on channel.channel_hash = xchan.xchan_hash where channel_id = %d and channel_account_id = %d and not ( channel_pageflags & %d) limit 1", intval($change_channel), intval(get_account_id()), intval(PAGE_REMOVED));
        if ($r) {
            $hash = $r[0]['channel_hash'];
            $_SESSION['uid'] = intval($r[0]['channel_id']);
            get_app()->set_channel($r[0]);
            $_SESSION['theme'] = $r[0]['channel_theme'];
            $_SESSION['mobile_theme'] = get_pconfig(local_user(), 'system', 'mobile_theme');
            date_default_timezone_set($r[0]['channel_timezone']);
            $ret = $r[0];
        }
        $x = q("select * from xchan where xchan_hash = '%s' limit 1", dbesc($hash));
        if ($x) {
            $_SESSION['my_url'] = $x[0]['xchan_url'];
            $_SESSION['my_address'] = $r[0]['channel_address'] . '@' . substr(get_app()->get_baseurl(), strpos(get_app()->get_baseurl(), '://') + 3);
            get_app()->set_observer($x[0]);
            get_app()->set_perms(get_all_perms(local_user(), $hash));
        }
        if (!is_dir('store/' . $r[0]['channel_address'])) {
            @os_mkdir('store/' . $r[0]['channel_address'], STORAGE_DEFAULT_PERMISSIONS, true);
        }
    }
    return $ret;
}
开发者ID:Mauru,项目名称:red,代码行数:27,代码来源:security.php

示例15: getDate

 static function getDate($campo = null)
 {
     date_default_timezone_set('Europe/Madrid');
     switch ($campo) {
         case "Y":
             intval(date("Y", $_SERVER["REQUEST_TIME"]));
             break;
         case "M":
             intval(date("M", $_SERVER["REQUEST_TIME"]));
             break;
         case "D":
             intval(date("D", $_SERVER["REQUEST_TIME"]));
             break;
         case "h":
             intval(date("h", $_SERVER["REQUEST_TIME"]));
             break;
         case "m":
             intval(date("m", $_SERVER["REQUEST_TIME"]));
             break;
         case "s":
             intval(date("s", $_SERVER["REQUEST_TIME"]));
             break;
         default:
             return $SERVER["REQUEST_TIME"];
             break;
     }
     return $_SERVER["REQUEST_TIME"];
 }
开发者ID:Alzhalas,项目名称:Clase-Util,代码行数:28,代码来源:Server.php


注:本文中的date_default_timezone_set函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。