Advertisement
Guest User

Untitled

a guest
Aug 17th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4. * Converts a Unix timestamp to local time, as defined in the WordPress settings (Settings --> General --> Timezone)
  5. * @author Ren Ventura <renventura.com>
  6. *
  7. * @param int $timestamp Unix timestamp (e.g. PHP time() function)
  8. * @param string $format Output format
  9. *
  10. * @return string Formatted time
  11. */
  12. function wp_local_time( $timestamp, $format = 'F j, Y g:i:s a' ) {
  13. return get_date_from_gmt( date_i18n( 'Y-m-d H:i:s', $timestamp ), $format );
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement