Skip to content

Instantly share code, notes, and snippets.

@ericandrewlewis
Created July 17, 2012 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ericandrewlewis/3129529 to your computer and use it in GitHub Desktop.
Save ericandrewlewis/3129529 to your computer and use it in GitHub Desktop.
// Accepts a UTC timestamp and outputs the Badgestack desired formatting
// in the locally set timezone based on the WP settting
function get_timestamp_locally_modified($timestamp) {
$date = new DateTime($timestamp, new DateTimeZone('UTC'));
date_timezone_set( $date, new DateTimeZone( get_option('timezone_string') ) );
$timestamp = $date->format( 'F j, Y \a\t h:ia' );
return $timestamp;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment