[wp-trac] [WordPress Trac] #39285: Date formatting shortcuts

WordPress Trac noreply at wordpress.org
Mon Nov 13 18:00:47 UTC 2017


#39285: Date formatting shortcuts
-------------------------------+------------------------------
 Reporter:  iseulde            |       Owner:
     Type:  feature request    |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Date/Time          |     Version:
 Severity:  normal             |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:
-------------------------------+------------------------------
Changes (by pbearne):

 * keywords:   => reporter-feedback


Comment:

 Hi


 Is this the sort of function you are suggesting?

 Do we have a list of formats


 {{{#!php
 <?php
 function get_date_format( $format ) {
         $date_string = '';
         switch ( strtolower( $format ) ) {
                 case 'time':
                     // Translator: time format
                         $date_string = __( 'G:i' );
                         break;
         // add more format as needed here

                 default:
                         $date_string = $format;
                         break;
         }

         return apply_filters( 'get_date_format', $date_string, $format );
 }
 }}}

 and add this line into date_i18n() and the_date() functions etc.

         {{{#!php
 <?php
 $dateformatstring = get_date_formatted( $dateformatstring );
 }}}

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


More information about the wp-trac mailing list