zoukankan      html  css  js  c++  java
  • PHP 按照时区获取当前时间

    /**
     * 时间格式化
     * @param string $dateformat 时间格式
     * @param int $timestamp 时间戳
     * @param int $timeoffset 时区偏差
     * @return string
     */
    function qgmdate($dateformat = 'Y-m-d H:i:s', $timestamp = '', $timeoffset = 8) {
     
        if(empty($timestamp)) {
            $timestamp = time();
        }
        $result = gmdate($dateformat, $timestamp + $timeoffset * 3600);
        return $result;
    }
    //-4是美国时间,8是默认的北京时间
    qgmdate('Y-m-d H:i:s', '', -4);
  • 相关阅读:
    Oracle
    注解
    java 算法实现
    ConcurrentHashMap
    hashMap 1.8
    hashmap 1.7
    MySQL优化
    Mysql面试题
    tmux
    mysql 复制表结构、表数据的方法
  • 原文地址:https://www.cnblogs.com/cocoqi/p/7685331.html
Copyright © 2011-2022 走看看