Date Functions and Formats

Date in PHP

<time data-publish-date="<?php echo esc_attr( sprintf( '%s 00:01', current_time( 'Y-m-d', false ) ) ); ?>" data-relative-time-timezone="<?php echo esc_attr( get_option( 'timezone_string' ) ); ?>">
	<span class="day">
		<?php echo esc_html( sprintf( '%s, ', current_time( 'l', false ) ) ); ?>
	</span>
	<?php echo esc_html( current_time( 'F d, Y', false ) ); ?>
</time>

Date in WordPress

echo get_the_date( 'F d, Y', $post_id );

Leave a Reply