get_post_time example

while ( have_posts() ) :
        the_post();
        ?> <item> <title><?php the_title_rss(); ?></title> <link><?php the_permalink_rss(); ?></link> <?php if ( get_comments_number() || comments_open() ) : ?> <comments><?php comments_link_feed(); ?></comments> <?php endif; ?> <dc:creator><![CDATA[<?php the_author(); ?>]]></dc:creator> <pubDate><?php echo mysql2date( 'D, d M Y H:i:s +0000', get_post_time( 'Y-m-d H:i:s', true ), false ); ?></pubDate> <?php the_category_rss( 'rss2' ); ?> <guid isPermaLink="false"><?php the_guid(); ?></guid> <?php if ( get_option( 'rss_use_excerpt' ) ) : ?> <description><![CDATA[<?php the_excerpt_rss(); ?>]]></description> <?php else : ?> <description><![CDATA[<?php the_excerpt_rss(); ?>]]></description> <?php $content = get_the_content_feed( 'rss2' ); ?> <?php if ( strlen( $content ) > 0 ) : ?> <content:encoded><![CDATA[<?php echo $content; ?>]]></content:encoded> <?php else : ?>
if ( ! current_user_can( get_post_type_object( 'customize_changeset' )->cap->edit_post, $changeset_post->ID ) ) {
        wp_die(
            '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
            '<p>' . __( 'Sorry, you are not allowed to edit this changeset.' ) . '</p>',
            403
        );
    }

    $missed_schedule = (
        'future' === $changeset_post->post_status &&
        get_post_time( 'G', true, $changeset_post ) < time()
    );
    if ( $missed_schedule ) {
        /* * Note that an Ajax request spawns here instead of just calling `wp_publish_post( $changeset_post->ID )`. * * Because WP_Customize_Manager is not instantiated for customize.php with the `settings_previewed=false` * argument, settings cannot be reliably saved. Some logic short-circuits if the current value is the * same as the value being saved. This is particularly true for options via `update_option()`. * * By opening an Ajax request, this is avoided and the changeset is published. See #39221. */
        

            do_action( 'atom_author' );
            ?> </author> <title type="<?php html_type_rss(); ?>"><![CDATA[<?php the_title_rss(); ?>]]></title> <link rel="alternate" type="<?php bloginfo_rss( 'html_type' ); ?>" href="<?php the_permalink_rss(); ?>" /> <id><?php the_guid(); ?></id> <updated><?php echo get_post_modified_time( 'Y-m-d\TH:i:s\Z', true ); ?></updated> <published><?php echo get_post_time( 'Y-m-d\TH:i:s\Z', true ); ?></published> <?php the_category_rss( 'atom' ); ?> <summary type="<?php html_type_rss(); ?>"><![CDATA[<?php the_excerpt_rss(); ?>]]></summary> <?php if ( ! get_option( 'rss_use_excerpt' ) ) : ?> <content type="<?php html_type_rss(); ?>" xml:base="<?php the_permalink_rss(); ?>"><![CDATA[<?php the_content_feed( 'atom' ); ?>]]></content> <?php endif; ?> <?php         atom_enclosure();

        

                $excerpt = wxr_cdata( apply_filters( 'the_excerpt_export', $post->post_excerpt ) );

                $is_sticky = is_sticky( $post->ID ) ? 1 : 0;
                ?> <item> <title><?php echo $title; ?></title> <link><?php the_permalink_rss(); ?></link> <pubDate><?php echo mysql2date( 'D, d M Y H:i:s +0000', get_post_time( 'Y-m-d H:i:s', true ), false ); ?></pubDate> <dc:creator><?php echo wxr_cdata( get_the_author_meta( 'login' ) ); ?></dc:creator> <guid isPermaLink="false"><?php the_guid(); ?></guid> <description></description> <content:encoded><?php echo $content; ?></content:encoded> <excerpt:encoded><?php echo $excerpt; ?></excerpt:encoded> <wp:post_id><?php echo (int) $post->ID; ?></wp:post_id> <wp:post_date><?php echo wxr_cdata( $post->post_date ); ?></wp:post_date> <wp:post_date_gmt><?php echo wxr_cdata( $post->post_date_gmt ); ?></wp:post_date_gmt> <wp:post_modified><?php echo wxr_cdata( $post->post_modified ); ?></wp:post_modified> <wp:post_modified_gmt><?php echo wxr_cdata( $post->post_modified_gmt ); ?></wp:post_modified_gmt> <wp:comment_status><?php echo wxr_cdata( $post->comment_status ); ?></wp:comment_status> <wp:ping_status>

function get_the_date( $format = '', $post = null ) {
    $post = get_post( $post );

    if ( ! $post ) {
        return false;
    }

    $_format = ! empty( $format ) ? $format : get_option( 'date_format' );

    $the_date = get_post_time( $_format, false, $post, true );

    /** * Filters the date a post was published. * * @since 3.0.0 * * @param string|int $the_date Formatted date string or Unix timestamp if `$format` is 'U' or 'G'. * @param string $format PHP date format. * @param WP_Post $post The post object. */
    return apply_filters( 'get_the_date', $the_date$format$post );
}
Home | Imprint | This part of the site doesn't use cookies.