wpdb – How do I change the datetime format from ( ‘y-m-d’ ) to ( ‘d m y’ )

Question

I have code that finds the date a page was last updated:

<?php global $wpdb; $psm_mod_datetime = $wpdb->get_var("SELECT post_modified FROM $wpdb->posts WHERE post_title="Current Chapter Volunteer Openings"");
echo("Updated:  " . substr($psm_mod_datetime, 0, 10));
?>

which prints Updated: 2021-09-05 after the page title. I need it to print Updated: 05 September 2021

How do I change the format for the date?

0
fuxia 4 weeks 2022-08-29T17:20:24-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse