Home › Forums › Calendar Products › Events Calendar PRO › Dates not showing correctly
- This topic has 7 replies, 4 voices, and was last updated 7 years, 9 months ago by Joanna Shebson.
-
AuthorPosts
-
June 23, 2016 at 5:09 am #1130842Joanna ShebsonParticipant
Times messed up here in the tab: http://prntscr.com/bjz47z http://www.funinjerusalem.com/israel-museum/#events
Time works on single event: http://www.funinjerusalem.com/event/big-art-little-artist/2016-06-27/
Here’s the code for the times on the Events tab:
It used to work, but somewhat recently has stopped working (not sure exactly when)
Any help is greatly appreciated.
<?php$start_date = tribe_get_start_date($event->ID,true,’F d Y g:H’);
$end_date = tribe_get_end_date($event->ID,true,’F d Y g:H’);
$this_event_date = ”;
$start = new DateTime( $start_date );
$end = new DateTime( $end_date);// Get number of days between by finding seconds between and dividing by # of seconds in a day
$days = round( ( $end->format( ‘U’ ) – $start->format( ‘U’ ) ) / ( 60 * 60 * 24 ) );if ($days == 0 ){
$end_date = date_format($end, ‘g:i A’);
}
if(tribe_event_is_all_day($event->ID)){
$this_event_date = date_format($start, ‘F d, Y’);
}
else{
$this_event_date = date_format($start, ‘F d Y @ g:H’) . ‘ – ‘ . $end_date;
}
?>June 23, 2016 at 2:55 pm #1131236AndrasKeymasterHello funinjerusalem,
I can try to help out here, but I am limited in supporting customizations.
I think in the first two lines and the last line you are displaying the hour twice: g:H
Instead try: g:i
Here is the reference guide for date formatting:
http://php.net/manual/en/function.date.php
Let me know if this fixes your issue.
Cheers,
AndrasJune 26, 2016 at 11:32 am #1132116Joanna ShebsonParticipantI tried changing it to g:i which helped but there are still 2 issues:
http://funevents.illuminea-dev.com/israel-museum/#events
1. It should say PM but says AM http://prntscr.com/blcpsw
2. If the start time and end time are the same on the same day, then it should only show once. Now it says 5:00 – 5:00 AM. Should say 5:00 PMJune 27, 2016 at 8:12 am #1132320AndrasKeymasterHello,
The AM / PM error doesn’t come from the code, but from how the event timings are set up. Please check if your event timings are set properly to the PM time.
As for start and end date, you would need to modify your custom code and add somewhere a line that checks this.
If start and end time are same, then only echo out start time (or end time). Otherwise echo as usual.
Something like this in the end:
else{
if ($start == $ end) {
$this_event_date = $end_date;
}
else {
$this_event_date = date_format($start, ‘F d Y @ g:H’) . ‘ – ‘ . $end_date;
}
}
Let me know if this solves it for you.Cheers,
AndrasJune 27, 2016 at 11:54 pm #1132753Joanna ShebsonParticipantThe PM is set properly in the dashboard: http://prntscr.com/bm0aud
And you can also see it working fine on single event page: http://funevents.illuminea-dev.com/event/tuesdays-israel-museum/2016-06-28/
The code you sent produces the following: http://prntscr.com/bm0dfd because of recurring events.
Thanks.June 29, 2016 at 2:23 pm #1133713AndrasKeymasterHey funinjerusalem,
Dang, I thought the last bit is gonna do the trick.
We are really limited in providing support for and doing customizations.
I’m sorry, I’m unable to dig into this any further, but I hope this serves as a blueprint to get you or a developer started to fix this.
Here you can find a list of freelancers, who might be able to take what I done and take it further to get what you need.
https://theeventscalendar.com/knowledgebase/find-a-customizer/I can try to answer some more questions, but have little else beyond what we have already provided.
Cheers,
AndrasJuly 14, 2016 at 9:35 am #1139755Support DroidKeymasterThis topic has not been active for quite some time and will now be closed.
If you still need assistance please simply open a new topic (linking to this one if necessary)
and one of the team will be only too happy to help. -
AuthorPosts
- The topic ‘Dates not showing correctly’ is closed to new replies.