web建站教程
  1. 首页
  2. vuejs
  3. js
  4. 好玩
  5. seo教程
  6. 前端知识
  7. 百度echarts
  8. 更多
    php入门
    nodejs
    mockjs
    reactjs
    mysql
    wordpress
    织梦cms
    帝国cms
    git教程
    IT知识
    模板大全
    休息站

wordpress如何利用current_time函数获取当前时间

392 ℃
     

wordpress如何利用current_time()函数获取当前时间,下面web建站小编给大家详细介绍一下具体用法!

函数源码:

function current_time( $type, $gmt = 0 ) {
  if ( 'timestamp' === $type || 'U' === $type ) {
    return $gmt ? time() : time() + (int) ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS );
  }
  
  if ( 'mysql' === $type ) {
    $type = 'Y-m-d H:i:s';
  }
  
  $timezone = $gmt ? new DateTimeZone( 'UTC' ) : wp_timezone();
  $datetime = new DateTime( 'now', $timezone );
  
  return $datetime->format( $type );
}

mysql有哪些时间语法

标签: current_time, wordpress获取当前时间

上面是“wordpress如何利用current_time函数获取当前时间”的全面内容,想了解更多关于 wordpress 内容,请继续关注web建站教程。

当前网址:https://ipkd.cn/webs_3868.html

声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

当前位置: 网站首页 > wordpress
本文共计373个字,预计阅读时长3分钟
生活小工具,收录了80多款小工具
上一篇: 推荐一款简单高效漂亮的多平台笔记应用——Zoho Notebook
下一篇: 推荐2款充满科技感的艺术字体——小新黑体、小新潮酷体
x 打工人ai神器