[wp-trac] [WordPress Trac] #21653: Introduce current_date()

WordPress Trac wp-trac at lists.automattic.com
Tue Aug 21 19:34:00 UTC 2012


#21653: Introduce current_date()
-------------------------+-----------------------------
 Reporter:  johnbillion  |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  low          |  Milestone:  Awaiting Review
Component:  General      |    Version:
 Severity:  normal       |   Keywords:
-------------------------+-----------------------------
 WordPress comes with a function called `current_time()` which returns the
 current time according to the timezone chosen on the General Settings
 screen. It's used when populating the post date, among other things.

 It would be nice to have a date equivalent of this function for outputting
 the current date according to the timezone setting. Currently if you want
 to output the current date you need to do this:
 {{{
 echo date( 'd/m/Y', current_time( 'timestamp' ) );
 }}}
 I'd like to be able to use this instead:
 {{{
 echo current_date( 'd/m/Y' );
 }}}

 Note that just using `date()` doesn't give the desired effect as WordPress
 sets the default timezone (as used by `date()`) to UTC, not to the
 timezone chosen on the settings screen.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/21653>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list