[wp-trac] [WordPress Trac] #57683: Improve performance of mysql2date

WordPress Trac noreply at wordpress.org
Wed Mar 8 10:48:35 UTC 2023


#57683: Improve performance of mysql2date
--------------------------+-----------------------------
 Reporter:  spacedmonkey  |       Owner:  (none)
     Type:  enhancement   |      Status:  new
 Priority:  normal        |   Milestone:  Future Release
Component:  Date/Time     |     Version:  0.71
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:  performance
--------------------------+-----------------------------

Comment (by Rarst):

 My thoughts so far, drafted in code:

 {{{#!php
 <?php
 // "proper" (timezone dealth with implicitly)
 $datetime     = get_post_datetime( $post );
 $currentday   = $datetime->format( 'd.m.y' );
 $currentmonth = $datetime->format( 'm' );
 var_dump( $currentday, $currentmonth );

 // "optimized" (handled as string, timezone-unaware)
 list( $year, $month, $day ) = explode( '-', substr( $post->post_date, 0,
 10 ) );
 $currentday   = $day . '.' . $month . '.' . substr( $year, 2 );
 $currentmonth = $month;
 var_dump( $currentday, $currentmonth );
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/57683#comment:15>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list