Created
May 7, 2013 13:10
-
-
Save arnalyse/5532442 to your computer and use it in GitHub Desktop.
shows how to get the correct UTC time with no offset out of a Wordpress post
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? php | |
/* | |
WORDPRESS: Howto get the UTC time of a post without an offset | |
source: http://codex.wordpress.org/Template_Tags/get_post_time | |
- the 'c' formats datetime string in ISO8601 | |
- the 'true' advises Wordpress to calculate the UTC/GMT | |
instead of the timezone defined in Wordpress | |
from wp-includes/general-template.php: | |
function get_post_time( $d = 'U', $gmt = false, $post = null, $translate = false ) | |
note: other functions rely on this one, like 'the_time' and 'get_the_time', | |
*/ | |
get_post_time('c', true) | |
get_post_modified_time('c', true) | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
And this is how should looks the time html5 tag:
of course for any timezone :)