I’m trying to create a page template where I can events in a customized way. I’ve pulled the events using a wpdb query you can see here:
select p.ID, d.EVT_ID, d.DTT_EVT_start, d.DTT_EVT_end
from bks_posts as p
inner join bks_esp_datetime as d
on p.ID = d.EVT_ID
where p.post_status = 'publish'
and p.post_type = 'espresso_events'
and p.ID != " . $convention_id . "
order by d.DTT_EVT_start;
This worked fine until my client wanted the wordpress install to use the America/Los_Angeles timezone. I went back to my template and noticed those times were all incorrect.
Is there a way to get the correct datetimes for events according to the set timezone?
Hi Jay, the datetimes are stored in the database using UTC. The offset to determine the local time is then calculated against the timezone that is set in WordPress General Settings.
Now, what’s strange… I’m using MAMP to develop locally and once it works on my local computer, I upload the new scripts to the live server. I was able to get everything to work on the MAMP install, but when I uploaded to the live server, I noticed that the dates were all off.
After var_dump the $events array I noticed that none of the events in the array had the DTT_EVT_start or DTT_EVT_end properties that were available on my MAMP version of the site. I can’t figure out why the datetimes aren’t attached to the event on one site and not the other.
Here’s some of the var_dump, if that helps:
array(5) {
[0]=>
object(WP_Post)#594 (38) {
["ID"]=>
int(3611)
["post_author"]=>
string(1) "2"
["post_date"]=>
string(19) "2015-01-27 20:15:00"
["post_date_gmt"]=>
string(19) "2015-01-27 20:15:00"
["post_content"]=>
string(721) "The kaleidoscope is 4.25 inches tall x 2 inches wide with a stained glass body. Students will fill the 1/2 inch x2 inch glass cell and put either a 2 mirror or 3 mirror system together.
<div class="row">
<div class="classCalTicketInfo panel large-6 columns">
Friday 1:30-5:30pm
Class Capacity : 10 tickets
Class Cost: $170.00
Purchases for these classes are made via the convention registration form
</div>
</div>"
["post_title"]=>
string(9) "Sue Rioux"
["post_excerpt"]=>
string(0) ""
["post_status"]=>
string(7) "publish"
["comment_status"]=>
string(6) "closed"
["ping_status"]=>
string(6) "closed"
["post_password"]=>
string(0) ""
["post_name"]=>
string(9) "sue-rioux"
["to_ping"]=>
string(0) ""
["pinged"]=>
string(0) ""
["post_modified"]=>
string(19) "2015-02-09 10:46:30"
["post_modified_gmt"]=>
string(19) "2015-02-09 18:46:30"
["post_content_filtered"]=>
string(0) ""
["post_parent"]=>
int(0)
["guid"]=>
string(66) "https://brewstersociety.com/?post_type=espresso_events&p=3611"
["menu_order"]=>
int(0)
["post_type"]=>
string(15) "espresso_events"
["post_mime_type"]=>
string(0) ""
["comment_count"]=>
string(1) "0"
["filter"]=>
string(3) "raw"
["EVTM_ID"]=>
string(2) "11"
["EVT_ID"]=>
string(4) "3611"
["EVT_display_desc"]=>
string(1) "0"
["EVT_display_ticket_selector"]=>
string(1) "0"
["EVT_visible_on"]=>
string(19) "2015-01-27 20:15:00"
["EVT_default_registration_status"]=>
string(3) "RPP"
["EVT_phone"]=>
string(0) ""
["EVT_additional_limit"]=>
string(1) "0"
["EVT_member_only"]=>
string(1) "0"
["EVT_allow_overflow"]=>
string(1) "0"
["EVT_timezone_string"]=>
string(0) ""
["EVT_external_URL"]=>
string(0) ""
["EVT_donations"]=>
string(1) "0"
["EE_Event"]=>
object(EE_Event)#667 (11) {
["_active_status":protected]=>
string(0) ""
["_Primary_Datetime":protected]=>
NULL
["_feature_image":protected]=>
array(0) {
}
["_props_n_values_provided_in_constructor":"EE_Base_Class":private]=>
array(22) {
["EVT_ID"]=>
int(3611)
["EVT_wp_user"]=>
string(1) "2"
["EVT_created"]=>
string(19) "2015-01-27 20:15:00"
["EVT_desc"]=>
string(721) "The kaleidoscope is 4.25 inches tall x 2 inches wide with a stained glass body. Students will fill the 1/2 inch x2 inch glass cell and put either a 2 mirror or 3 mirror system together.
<div class="row">
<div class="classCalTicketInfo panel large-6 columns">
Friday 1:30-5:30pm
Class Capacity : 10 tickets
Class Cost: $170.00
Purchases for these classes are made via the convention registration form
</div>
</div>"
["EVT_name"]=>
string(9) "Sue Rioux"
["EVT_short_desc"]=>
string(0) ""
["status"]=>
string(7) "publish"
["EVT_slug"]=>
string(9) "sue-rioux"
["EVT_modified"]=>
string(19) "2015-02-09 10:46:30"
["parent"]=>
int(0)
["EVT_order"]=>
int(0)
["EVT_display_desc"]=>
string(1) "0"
["EVT_display_ticket_selector"]=>
string(1) "0"
["EVT_visible_on"]=>
string(19) "2015-01-27 20:15:00"
["EVT_default_registration_status"]=>
string(3) "RPP"
["EVT_phone"]=>
string(0) ""
["EVT_additional_limit"]=>
string(1) "0"
["EVT_member_only"]=>
string(1) "0"
["EVT_allow_overflow"]=>
string(1) "0"
["EVT_timezone_string"]=>
string(0) ""
["EVT_external_URL"]=>
string(0) ""
["EVT_donations"]=>
string(1) "0"
}
["_timezone":protected]=>
string(19) "America/Los_Angeles"
["_dt_frmt":protected]=>
string(6) "F j, Y"
["_tm_frmt":protected]=>
string(5) "g:i a"
["_cached_properties":protected]=>
array(0) {
}
["_model_relations":protected]=>
array(8) {
["Registration"]=>
array(0) {
}
["Datetime"]=>
array(0) {
}
["Question_Group"]=>
array(0) {
}
["Venue"]=>
array(0) {
}
["Term_Taxonomy"]=>
array(0) {
}
["Message_Template_Group"]=>
array(0) {
}
["Attendee"]=>
array(0) {
}
["Extra_Meta"]=>
array(0) {
}
}
["_fields":protected]=>
array(22) {
["EVT_ID"]=>
int(3611)
["EVT_wp_user"]=>
int(2)
["EVT_created"]=>
int(1422389700)
["EVT_desc"]=>
string(721) "The kaleidoscope is 4.25 inches tall x 2 inches wide with a stained glass body. Students will fill the 1/2 inch x2 inch glass cell and put either a 2 mirror or 3 mirror system together.
<div class="row">
<div class="classCalTicketInfo panel large-6 columns">
Friday 1:30-5:30pm
Class Capacity : 10 tickets
Class Cost: $170.00
Purchases for these classes are made via the convention registration form
</div>
</div>"
["EVT_name"]=>
string(9) "Sue Rioux"
["EVT_short_desc"]=>
string(0) ""
["status"]=>
string(7) "publish"
["EVT_slug"]=>
string(9) "sue-rioux"
["EVT_modified"]=>
int(1423478790)
["parent"]=>
int(0)
["EVT_order"]=>
int(0)
["EVT_display_desc"]=>
int(0)
["EVT_display_ticket_selector"]=>
int(0)
["EVT_visible_on"]=>
int(1422389700)
["EVT_default_registration_status"]=>
string(3) "RPP"
["EVT_phone"]=>
string(0) ""
["EVT_additional_limit"]=>
int(0)
["EVT_member_only"]=>
int(0)
["EVT_allow_overflow"]=>
int(0)
["EVT_timezone_string"]=>
string(0) ""
["EVT_external_URL"]=>
string(0) ""
["EVT_donations"]=>
int(0)
}
["_Extra_Meta":protected]=>
NULL
}
}
[1]=>
object(WP_Post)#662 (38) {
["ID"]=>
int(2406)
["post_author"]=>
string(2) "53"
["post_date"]=>
string(19) "2015-01-05 05:42:19"
["post_date_gmt"]=>
string(19) "2015-01-05 05:42:19"
["post_content"]=>
string(1830) "Jim and Rita Duxbury will demonstrate the construction of his traditional model wooden kaleidoscope. This Traditional Kaleidoscope is designed to be turned on a wood lathe using basic tools and intermediate woodturning techniques. Participants will not be making a completed kaleidoscope during this class but will be learning the techniques used by Jim to create this kaleidoscope. Jim will show the fabrication of his unique cone jig for turning the center-less kaleidoscope barrel and end cylinder. This technique can also be used to turn numerous other center-less objects. Additionally, he will demonstrate and construct the object box, cut glass for the eye piece, and also cut the first surface mirror using his mirror cutting jig.
This kaleidoscope is the culmination of numerous turned wooden kaleidoscope designs brought together through Jim’s creativity and use of the wood lathe. This custom 3 mirror scope has an oil-filled object box and prism exterior lens contained in a rotatable end cylinder with a matching cradle.
Each attendee will receive a full set of detailed plans with instructions, cradle plan, material list, and history. Plans of other models and a DVD of step-by-step instructions will be available at an additional cost.
<div class="row">
<div class="classCalTicketInfo panel large-6 columns">
Friday 2:00-5:00pm
Class Capacity : 10 tickets
Class Cost: $70.00
Purchases for these classes are made via the convention registration form
You swapped from a WP Query that joined a secondary table, and moved to a get_posts which only queries the posts table. EE doesn’t store all event data within the post itself due to the complex nature of the datetime and pricing systems.
The support post ‘Events from database don't show correct time for timezone’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.
Support forum for Event Espresso 3 and Event Espresso 4.