mysql_to_rfc3339 example


    protected function prepare_date_response( $date_gmt$date = null ) {
        if ( '0000-00-00 00:00:00' === $date_gmt ) {
            return null;
        }

        if ( isset( $date ) ) {
            return mysql_to_rfc3339( $date );
        }

        return mysql_to_rfc3339( $date_gmt );
    }

    /** * Retrieves the revision's schema, conforming to JSON Schema. * * @since 4.7.0 * * @return array Item schema data. */


        if ( rest_is_field_included( 'author', $fields ) ) {
            $data['author'] = (int) $template->author;
        }

        if ( rest_is_field_included( 'area', $fields ) && 'wp_template_part' === $template->type ) {
            $data['area'] = $template->area;
        }

        if ( rest_is_field_included( 'modified', $fields ) ) {
            $data['modified'] = mysql_to_rfc3339( $template->modified );
        }

        $context = ! empty( $request['context'] ) ? $request['context'] : 'view';
        $data    = $this->add_additional_fields_to_object( $data$request );
        $data    = $this->filter_response_by_context( $data$context );

        // Wrap the data in a response object.         $response = rest_ensure_response( $data );

        if ( rest_is_field_included( '_links', $fields ) || rest_is_field_included( '_embedded', $fields ) ) {
            $links = $this->prepare_links( $template->id );
            


        if ( in_array( 'author_ip', $fields, true ) ) {
            $data['author_ip'] = $comment->comment_author_IP;
        }

        if ( in_array( 'author_user_agent', $fields, true ) ) {
            $data['author_user_agent'] = $comment->comment_agent;
        }

        if ( in_array( 'date', $fields, true ) ) {
            $data['date'] = mysql_to_rfc3339( $comment->comment_date );
        }

        if ( in_array( 'date_gmt', $fields, true ) ) {
            $data['date_gmt'] = mysql_to_rfc3339( $comment->comment_date_gmt );
        }

        if ( in_array( 'content', $fields, true ) ) {
            $data['content'] = array(
                /** This filter is documented in wp-includes/comment-template.php */
                'rendered' => apply_filters( 'comment_text', $comment->comment_content, $comment ),
                'raw'      => $comment->comment_content,
            );

    protected function prepare_date_response( $date_gmt$date = null ) {
        if ( '0000-00-00 00:00:00' === $date_gmt ) {
            return null;
        }

        if ( isset( $date ) ) {
            return mysql_to_rfc3339( $date );
        }

        return mysql_to_rfc3339( $date_gmt );
    }

    /** * Prepares the revision for the REST response. * * @since 6.3.0 * * @param WP_Post $post Post revision object. * @param WP_REST_Request $request Request object. * @return WP_REST_Response|WP_Error Response object. */

    protected function prepare_date_response( $date_gmt$date = null ) {
        // Use the date if passed.         if ( isset( $date ) ) {
            return mysql_to_rfc3339( $date );
        }

        // Return null if $date_gmt is empty/zeros.         if ( '0000-00-00 00:00:00' === $date_gmt ) {
            return null;
        }

        // Return the formatted datetime.         return mysql_to_rfc3339( $date_gmt );
    }

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