Docs: Clarify descriptions for get_gmt_from_date() and get_date_from_gmt().

Props johnbillion, Rarst.
Fixes #48650.

git-svn-id: https://develop.svn.wordpress.org/trunk@46958 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2019-12-13 21:43:06 +00:00
parent 5e840c755e
commit 1440dab429

View File

@ -3497,16 +3497,16 @@ function _wp_iso_convert( $match ) {
} }
/** /**
* Returns a date in the GMT equivalent. * Given a date in the timezone of the site, returns that date in UTC timezone.
* *
* Requires and returns a date in the Y-m-d H:i:s format. * Requires and returns a date in the Y-m-d H:i:s format.
* Return format can be overridden using the $format parameter. * Return format can be overridden using the $format parameter.
* *
* @since 1.2.0 * @since 1.2.0
* *
* @param string $string The date to be converted. * @param string $string The date to be converted, in the timezone of the site.
* @param string $format The format string for the returned date. Default 'Y-m-d H:i:s'. * @param string $format The format string for the returned date. Default 'Y-m-d H:i:s'.
* @return string GMT version of the date provided. * @return string Formatted version of the date, in UTC timezone.
*/ */
function get_gmt_from_date( $string, $format = 'Y-m-d H:i:s' ) { function get_gmt_from_date( $string, $format = 'Y-m-d H:i:s' ) {
$datetime = date_create( $string, wp_timezone() ); $datetime = date_create( $string, wp_timezone() );
@ -3519,16 +3519,16 @@ function get_gmt_from_date( $string, $format = 'Y-m-d H:i:s' ) {
} }
/** /**
* Converts a GMT date into the correct format for the blog. * Given a date in UTC timezone, returns that date in the timezone of the site.
* *
* Requires and returns a date in the Y-m-d H:i:s format. * Requires and returns a date in the Y-m-d H:i:s format.
* Return format can be overridden using the $format parameter. * Return format can be overridden using the $format parameter.
* *
* @since 1.2.0 * @since 1.2.0
* *
* @param string $string The date to be converted. * @param string $string The date to be converted, in UTC timezone.
* @param string $format The format string for the returned date. Default 'Y-m-d H:i:s'. * @param string $format The format string for the returned date. Default 'Y-m-d H:i:s'.
* @return string Formatted date relative to the timezone. * @return string Formatted version of the date, in the site's timezone.
*/ */
function get_date_from_gmt( $string, $format = 'Y-m-d H:i:s' ) { function get_date_from_gmt( $string, $format = 'Y-m-d H:i:s' ) {
$datetime = date_create( $string, new DateTimeZone( 'UTC' ) ); $datetime = date_create( $string, new DateTimeZone( 'UTC' ) );