[wp-trac] [WordPress Trac] #48976: Current_time

WordPress Trac noreply at wordpress.org
Mon Dec 16 12:07:46 UTC 2019


#48976: Current_time
-------------------------------+------------------------------
 Reporter:  autotutorial       |       Owner:  (none)
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Date/Time          |     Version:  5.3
 Severity:  normal             |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:
-------------------------------+------------------------------

Comment (by autotutorial):

 https://developer.wordpress.org/reference/functions/current_time/
 {{{#!php
 <?php
 // Bad
 return $gmt ? time() : time() + (int) ( get_option( 'gmt_offset' ) *
 HOUR_IN_SECONDS );
 }}}
 I haven't checked in WordPress but in my code.
 {{{#!php
 <?php
 $timezone = $gmt ? new DateTimeZone( 'UTC' ) : wp_timezone();
 }}}
 This for $gmt = 0 create string, not object.

 Thanks for your answers,
 https://www.php.net/manual/en/class.datetimezone.php#122558

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


More information about the wp-trac mailing list