mysql_to_rfc3339() - WordPress 函数参考中文文档

返回介绍

mysql_to_rfc3339()

发布于 2017-09-11 字数1787 浏览 977 评论 0

mysql_to_rfc3339( string $date_string )

Parses and formats a MySQL datetime (Y-m-d H:i:s) for ISO8601/RFC3339.


描述

Explicitly strips timezones, as datetimes are not saved with any timezone information. Including any information on the offset could be misleading.


参数

$date_string

(string)
(Required)
Date string to parse and format.


返回值

(string) Date formatted for ISO8601/RFC3339.


源代码

File: wp-includes/functions.php

function mysql_to_rfc3339( $date_string ) {
	$formatted = mysql2date( 'c', $date_string, false );

	// Strip timezone information
	return preg_replace( '/(?:Z|[+-]\d{2}(?::\d{2})?)$/', '', $formatted );
}

更新日志

Version 描述
4.4.0 Introduced.

相关函数

Uses

  • wp-includes/functions.php:
    mysql2date()

Used By

  • wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php:
    WP_REST_Revisions_Controller::prepare_date_response()
  • wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php:
    WP_REST_Posts_Controller::prepare_date_response()
  • wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php:
    WP_REST_Comments_Controller::prepare_item_for_response()

User Contributed Notes

上一篇:mysql2date()

下一篇:network_admin_url()

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!