Title: Date format issue
Last modified: November 23, 2019

---

# Date format issue

 *  [mkbarraco](https://wordpress.org/support/users/mkbarraco/)
 * (@mkbarraco)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/date-format-issue-3/)
 * Hi there, according to the latest changes to the core, how should I transform
   the dates below?
 *     ```
       function et_last_modified_date_blog( $the_date ) {
           if ( 'post' === get_post_type() ) {
               $the_time = get_post_time( 'His' );
               $the_modified = get_post_modified_time( 'His' );
   
       	$last_modified =  sprintf( __( 'Last updated %s', 'Divi' ), esc_html( get_post_modified_time( 'd m Y \a\l\l\e g:iA' ) ) );
       		$published =  sprintf( __( 'Del %s', 'Divi' ), esc_html( get_post_time( 'd m Y' ) ) );
   
               $date = $the_modified !== $the_time ? $last_modified . ' | ' .  $published : $published;
   
               return $date;
           }
       }
       add_action( 'get_the_date', 'et_last_modified_date_blog' );
       add_action( 'get_the_time', 'et_last_modified_date_blog' );
       ```
   
    -  This topic was modified 6 years, 5 months ago by [Steven Stern (sterndata)](https://wordpress.org/support/users/sterndata/).

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [Joy](https://wordpress.org/support/users/joyously/)
 * (@joyously)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/date-format-issue-3/#post-12168735)
 * Why would you change anything?
    The date changes in core were made to fix some
   inconsistencies (and a few more changes are coming since these caused a few issues).
 *  [autotutorial](https://wordpress.org/support/users/autotutorial/)
 * (@autotutorial)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/date-format-issue-3/#post-12168778)
 * instead of modifying you can change the display with filters and php code. (if
   you really don’t want to use the **general setting** of date_format).
    [https://developer.wordpress.org/reference/hooks/get_the_date/](https://developer.wordpress.org/reference/hooks/get_the_date/)
   [https://developer.wordpress.org/reference/hooks/get_post_modified_time/](https://developer.wordpress.org/reference/hooks/get_post_modified_time/)
   in mysql the dates must be archived `YYYY-MM-DD hh:mm:ss` for column **DATETIME**
   Recover the date from the database and calculate the difference of your offeset
   if you don’t have UTC as default.
 * [https://wordpress.org/support/topic/problems-with-timezone-when-using-new-function-wp_date/#post-12155158](https://wordpress.org/support/topic/problems-with-timezone-when-using-new-function-wp_date/#post-12155158)
   
   Classe DateTime PHP example. I hope it helps you
 *  Thread Starter [mkbarraco](https://wordpress.org/support/users/mkbarraco/)
 * (@mkbarraco)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/date-format-issue-3/#post-12169141)
 * I only need to show the Last Update on post, under the title. I used this code(
   develop by ET team) for years, but after last Wp update, I notice an issue in
   the back-end.
 * I try to use also this code in single-post.php, but…
 * <?php echo (esc_html( get_post_modified_time( ‘d/m/Y \a\l\l\e g:i A’ ))); ?>
    -  This reply was modified 6 years, 5 months ago by [mkbarraco](https://wordpress.org/support/users/mkbarraco/).
    -  This reply was modified 6 years, 5 months ago by [mkbarraco](https://wordpress.org/support/users/mkbarraco/).
 *  [Joy](https://wordpress.org/support/users/joyously/)
 * (@joyously)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/date-format-issue-3/#post-12169721)
 * If the date changes caused an issue, please report it (search first)
    [https://core.trac.wordpress.org/](https://core.trac.wordpress.org/)
 * Give details of what is wrong.
 *  [autotutorial](https://wordpress.org/support/users/autotutorial/)
 * (@autotutorial)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/date-format-issue-3/#post-12170781)
 *     ```
       <?php 
       function yournamefunction() {
       $create = get_post_modified_time('d/m/Y \a\l\l\e g:i A',true );
       return $create;
       }
   
       add_action('get_the_time','yournamefunction');
       ```
   
 * does it work for you? With $gmt to true

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Date format issue’ is closed to new replies.

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 5 replies
 * 3 participants
 * Last reply from: [autotutorial](https://wordpress.org/support/users/autotutorial/)
 * Last activity: [6 years, 5 months ago](https://wordpress.org/support/topic/date-format-issue-3/#post-12170781)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
