get_the_time example

public function column_date( $post ) {
        global $mode;

        if ( '0000-00-00 00:00:00' === $post->post_date ) {
            $t_time    = __( 'Unpublished' );
            $time_diff = 0;
        } else {
            $t_time = sprintf(
                /* translators: 1: Post date, 2: Post time. */
                __( '%1$s at %2$s' ),
                /* translators: Post date format. See https://www.php.net/manual/datetime.format.php */
                get_the_time( __( 'Y/m/d' )$post ),
                /* translators: Post time format. See https://www.php.net/manual/datetime.format.php */
                get_the_time( __( 'g:i a' )$post )
            );

            $time      = get_post_timestamp( $post );
            $time_diff = time() - $time;
        }

        if ( 'publish' === $post->post_status ) {
            $status = __( 'Published' );
        } elseif ( 'future' === $post->post_status ) {
            

                ?> </p> <?php elseif ( is_day() ) : /* If this is a daily archive */ ?> <p> <?php                     printf(
                        /* translators: 1: Site link, 2: Archive date. */
                        __( 'You are currently browsing the %1$s blog archives for the day %2$s.' ),
                        sprintf( '<a href="%1$s/">%2$s</a>', get_bloginfo( 'url' )get_bloginfo( 'name' ) ),
                        get_the_time( __( 'l, F jS, Y' ) )
                    );
                ?> </p> <?php elseif ( is_month() ) : /* If this is a monthly archive */ ?> <p> <?php                     printf(
                        /* translators: 1: Site link, 2: Archive month. */
                        __( 'You are currently browsing the %1$s blog archives for %2$s.' ),
                        sprintf( '<a href="%1$s/">%2$s</a>', get_bloginfo( 'url' )get_bloginfo( 'name' ) ),
                        
// Prepare Customizer settings to pass to JavaScript.         $changeset_post = null;
        if ( $changeset_post_id ) {
            $changeset_post = get_post( $changeset_post_id );
        }

        // Determine initial date to be at present or future, not past.         $current_time = current_time( 'mysql', false );
        $initial_date = $current_time;
        if ( $changeset_post ) {
            $initial_date = get_the_time( 'Y-m-d H:i:s', $changeset_post->ID );
            if ( $initial_date < $current_time ) {
                $initial_date = $current_time;
            }
        }

        $lock_user_id = false;
        if ( $this->changeset_post_id() ) {
            $lock_user_id = wp_check_post_lock( $this->changeset_post_id() );
        }

        $settings = array(
            

function the_time( $format = '' ) {
    /** * Filters the time a post was written for display. * * @since 0.71 * * @param string $get_the_time The formatted time. * @param string $format Format to use for retrieving the time the post * was written. Accepts 'G', 'U', or PHP date format. */
    echo apply_filters( 'the_time', get_the_time( $format )$format );
}

/** * Retrieves the time at which the post was written. * * @since 1.5.0 * * @param string $format Optional. Format to use for retrieving the time the post * was written. Accepts 'G', 'U', or PHP date format. * Defaults to the 'time_format' option. * @param int|WP_Post $post Post ID or post object. Default is global `$post` object. * @return string|int|false Formatted date string or Unix timestamp if `$format` is 'U' or 'G'. * False on failure. */
foreach ( $drafts as $draft ) {
        $url   = get_edit_post_link( $draft->ID );
        $title = _draft_or_post_title( $draft->ID );

        echo "<li>\n";
        printf(
            '<div class="draft-title"><a href="%s" aria-label="%s">%s</a><time datetime="%s">%s</time></div>',
            esc_url( $url ),
            /* translators: %s: Post title. */
            esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' )$title ) ),
            esc_html( $title ),
            get_the_time( 'c', $draft ),
            get_the_time( __( 'F j, Y' )$draft )
        );

        $the_content = wp_trim_words( $draft->post_content, $draft_length );

        if ( $the_content ) {
            echo '<p>' . $the_content . '</p>';
        }
        echo "</li>\n";
    }

    
public function column_date( $post ) {
        if ( '0000-00-00 00:00:00' === $post->post_date ) {
            $h_time = __( 'Unpublished' );
        } else {
            $time      = get_post_timestamp( $post );
            $time_diff = time() - $time;

            if ( $time && $time_diff > 0 && $time_diff < DAY_IN_SECONDS ) {
                /* translators: %s: Human-readable time difference. */
                $h_time = sprintf( __( '%s ago' )human_time_diff( $time ) );
            } else {
                $h_time = get_the_time( __( 'Y/m/d' )$post );
            }
        }

        /** * Filters the published time of an attachment displayed in the Media list table. * * @since 6.0.0 * * @param string $h_time The published time. * @param WP_Post $post Attachment object. * @param string $column_name The column name. */
Home | Imprint | This part of the site doesn't use cookies.