Home › Forums › Calendar Products › Events Calendar PRO › Time formatting question
- This topic has 5 replies, 3 voices, and was last updated 11 years ago by
Support Droid.
-
AuthorPosts
-
September 30, 2012 at 2:42 pm #25918
Shawn
ParticipantI’m having a problem getting the time formatted the way I want. I’ve duplicated the “table.php” file into an “events” directory in my theme, and have modified the event time to use this code:
date_i18n( get_option( ‘time_format’, ‘g:ia’ ), $start)The problem is that it’s not respecting the “g:ia” format; I’m getting it formatted like g:i a (e.g. 8:00 am instead of 8:00am).
I’ve tried switching themes to no effect.
Any ideas?September 30, 2012 at 2:47 pm #25919Shawn
ParticipantNever mind – I figured out that I could use
tribe_get_start_date(null, false, ‘g:ia’);
instead.
Why are there two different methods used to output the event start and end times in the plugin? Just curious…
October 1, 2012 at 6:21 am #25925Barry
MemberHi Shawn. When you use get_option() you are specifying a piece of information you wish to receive and – just in case that piece of information doesn’t exist – you are also specifying a default or fall back value.
So get_option(‘time_format’, ‘g:ia’) will not return ‘g:ia’ unless 1) the WordPress time_format setting doesn’t exist in the database, which would be very unusual, or 2) time_format itself is set to ‘g:ia’ (this can be controlled via the WordPress settings admin pages).
You’re correct that different methods are used within the plugins – there is no official answer for that, it really depends on a mixture of things such as the context, the programming style of the developer who committed that piece of code and so on.
Of course we try for a high level of consistency but now and again these things might get away from us.
I hope that answers your questions and just let me know if you need any further support 🙂
October 1, 2012 at 6:31 am #25928Shawn
ParticipantAhh, got it. Thanks for the answer, Barry!
October 1, 2012 at 7:08 am #25932Barry
MemberNo problem!
July 7, 2015 at 6:26 am #977880Support Droid
KeymasterThis 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 ‘Time formatting question’ is closed to new replies.
