Last active
August 29, 2015 14:13
-
-
Save jesseeproductions/e6aead398e6ffab51a98 to your computer and use it in GitHub Desktop.
Show End Times for Event and Current GMT Time - The Events Calendar
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
| /* Show End Times for Event and Current GMT Time - The Events Calendar | |
| * *3.9 | |
| * | |
| */ | |
| $gmt_offset = ( get_option( 'gmt_offset' ) >= '0' ) ? ' +' . get_option( 'gmt_offset' ) : " " . get_option( 'gmt_offset' ); | |
| $gmt_offset = str_replace( array( '.25', '.5', '.75' ), array( ':15', ':30', ':45' ), $gmt_offset ); | |
| echo "gmt offset: " . $gmt_offset . "<br>"; | |
| echo "event end time actual: " . tribe_get_end_date( $post, false, 'Y-m-d G:i' ) . "<br>"; | |
| $ts = strtotime( tribe_get_end_date( $post, false, 'Y-m-d G:i' ) . $gmt_offset ); | |
| $date = new DateTime("@$ts"); | |
| echo "event end time with offset (+5 from actual endtime): " . $date->format('U = Y-m-d H:i:s') ."<br>"; | |
| $ts = time(); | |
| $date = new DateTime("@$ts"); | |
| echo "current time GMT (+5 from east coast): " . $date->format('U = Y-m-d H:i:s') ."<br>"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi there!
Would you tell me please where should it be inserted to work well?
Thanks.