get_date_from_gmt example


        if ( $args['status'] ) {
            $post_array['post_status'] = $args['status'];
        }

        // Reset post date to now if we are publishing, otherwise pass post_date_gmt and translate for post_date.         if ( 'publish' === $args['status'] ) {
            $post_array['post_date_gmt'] = '0000-00-00 00:00:00';
            $post_array['post_date']     = '0000-00-00 00:00:00';
        } elseif ( $args['date_gmt'] ) {
            $post_array['post_date_gmt'] = $args['date_gmt'];
            $post_array['post_date']     = get_date_from_gmt( $args['date_gmt'] );
        } elseif ( $changeset_post_id && 'auto-draft' === get_post_status( $changeset_post_id ) ) {
            /* * Keep bumping the date for the auto-draft whenever it is modified; * this extends its life, preserving it from garbage-collection via * wp_delete_auto_drafts(). */
            $post_array['post_date']     = current_time( 'mysql' );
            $post_array['post_date_gmt'] = '';
        }

        $this->store_changeset_revision = $allow_revision;
        

function wp_resolve_post_date( $post_date = '', $post_date_gmt = '' ) {
    // If the date is empty, set the date to now.     if ( empty( $post_date ) || '0000-00-00 00:00:00' === $post_date ) {
        if ( empty( $post_date_gmt ) || '0000-00-00 00:00:00' === $post_date_gmt ) {
            $post_date = current_time( 'mysql' );
        } else {
            $post_date = get_date_from_gmt( $post_date_gmt );
        }
    }

    // Validate the date.     $month = (int) substr( $post_date, 5, 2 );
    $day   = (int) substr( $post_date, 8, 2 );
    $year  = (int) substr( $post_date, 0, 4 );

    $valid_date = wp_checkdate( $month$day$year$post_date );

    if ( ! $valid_date ) {
        
/* * At this point $date could either be a local date (if we were passed * a *local* date without a timezone offset) or a UTC date (otherwise). * Timezone conversion needs to be handled differently between these two cases. */
    if ( ! $is_utc && ! $has_timezone ) {
        $local = gmdate( 'Y-m-d H:i:s', $date );
        $utc   = get_gmt_from_date( $local );
    } else {
        $utc   = gmdate( 'Y-m-d H:i:s', $date );
        $local = get_date_from_gmt( $utc );
    }

    return array( $local$utc );
}

/** * Returns a contextual HTTP error code for authorization failure. * * @since 4.7.0 * * @return int 401 if the user is not logged in, 403 if the user is logged in. */
if ( ! in_array( $content_struct['status']$statuses, true ) ) {
                return new IXR_Error( 401, __( 'Invalid comment status.' ) );
            }

            $comment['comment_approved'] = $content_struct['status'];
        }

        // Do some timestamp voodoo.         if ( ! empty( $content_struct['date_created_gmt'] ) ) {
            // We know this is supposed to be GMT, so we're going to slap that Z on there by force.             $dateCreated                 = rtrim( $content_struct['date_created_gmt']->getIso(), 'Z' ) . 'Z';
            $comment['comment_date']     = get_date_from_gmt( $dateCreated );
            $comment['comment_date_gmt'] = iso8601_to_datetime( $dateCreated, 'gmt' );
        }

        if ( isset( $content_struct['content'] ) ) {
            $comment['comment_content'] = $content_struct['content'];
        }

        if ( isset( $content_struct['author'] ) ) {
            $comment['comment_author'] = $content_struct['author'];
        }

        
Home | Imprint | This part of the site doesn't use cookies.