Home › Forums › Calendar Products › Events Calendar PRO › Get event's date & time in SQL time format
- This topic has 6 replies, 2 voices, and was last updated 10 years, 6 months ago by
Brian.
-
AuthorPosts
-
October 23, 2015 at 12:18 pm #1017411
Daniel Eizik
ParticipantHi,
First of all, I’m using the Events Calendar Pro plugin with Avada.
I want to add the countdown shortcode to the single event page. I managed to add it and my only problem is that the shortcode needs the event’s date and time in SQL time format (YYYY-MM-DD HH-MM-SS) (E.g. 2016-05-10 12:30:00).
How can I get it so that I can add it on the single-event.php page?Thanks,
Daniel.October 23, 2015 at 2:33 pm #1017481Brian
MemberHi,
Thanks for using our plugins. I can try to help out here, but might not be able to provide everything for a feature we do not provide.
This following coding should work in the single-template.php to get the start date format it to
$startDate_mysql = strtotime( get_post_meta( $event_id, '_EventStartDate', True ) );
$startDate_mysql = date( 'Y-m-d H:i:s', $startDate_mysql );Then you could use $startDate_mysql wherever you need the date to be placed.
Thanks
October 24, 2015 at 5:32 am #1017533Daniel Eizik
ParticipantHi Brian,
Thanks for your comment but I couldn’t understand where I should try and implement this code.
As you wrote, I assume all I need is just to have a variable which contains the event’s date and time in this format.Would appreciate any help you can give me.
Thanks,
Daniel.October 24, 2015 at 6:09 am #1017539Daniel Eizik
ParticipantI tried inserting this code in the single-event.php file which is in my theme folder and than add this variable to the same page but all I got is this date and time: 1970-01-01 00:00:00
So I guess there’s a problem with the code you gave me or I’m not inserting it in the right place (Which is probably more likely).Thanks again,
Daniel.October 26, 2015 at 5:59 am #1017826Brian
MemberHi,
I updated the coding again. I realized I did not have the correct variable in the 2nd line.
That should work better now.
October 26, 2015 at 7:27 am #1017879Daniel Eizik
ParticipantThanks Brian.
Your solution is good but I had to change the _EventEndDate TO _EventStartDate.
I’m sure it may help someone if you correct the code.Thanks again for your help,
Daniel.October 26, 2015 at 7:39 am #1017881Brian
MemberOh yeah. I missed that.
Thanks. I fixed it now.
Since this is marked resolved I am going to close this ticket, but if you need anything else related to this topic or another please post a new topic on the forum and we can help you out.
Thanks
-
AuthorPosts
- The topic ‘Get event's date & time in SQL time format’ is closed to new replies.
