Date Format Customization

I'm looking to customize the way in which event dates appear.

First, I'd like to be able to get the individual parts of the date in order to customize their appearance. That is, I do NOT want the full string that includes the words "On" and "to". I'd like the fields separately.

Second, I'd like the be able to change the date format.

Example:
Start Date: Day of week, Month, Day, Year (Monday, August 20, 2012)
Start Time: HH:M am/pm
End Date: Day of week, Month, Day, Year
End Time: HH:M am/pm

Is there away to display the Start Date, Start Time, End Date and End Time separately in my template?

In addition, is there a way to change the actual date format. Such as date('D., M. j, Y - g:i a') or date('l, F j, Y - g:i a') ?

  • PC

    Hello misfist,

    Greetings and thanks for posting on the forums.

    Is there away to display the Start Date, Start Time, End Date and End Time separately in my template?

    I am sure changing the date in WordPress settings would do that task. I tried that and it worked. Can you please try that once and see if it suits your needs ?

    http://codex.wordpress.org/Formatting_Date_and_Time

    Please advise

    Second, I'd like the be able to change the date format.

    Example:
    Start Date: Day of week, Month, Day, Year (Monday, August 20, 2012)
    Start Time: HH:M am/pm
    End Date: Day of week, Month, Day, Year
    End Time: HH:M am/pm

    Is there away to display the Start Date, Start Time, End Date and End Time separately in my template?

    I am gonna have to look into this and see what I can find.

    Cheers
    PC

  • PC

    Hiya !

    Second, I don't want the date string (why would the default start with "On"?), I want to be able to access the date fields in my template,

    That should be somewhere around lines 499-505 in events-and-bookings/lib/class_eab_template.php

    $start_string = $event->has_no_start_time($key)
    				? sprintf(__('When is it ? <span class="wpmudevevents-date_format-start">%s</span>', Eab_EventsHub::TEXT_DOMAIN), date_i18n(get_option('date_format'), $start))
    				: sprintf(__('When is it ? %s <span class="wpmudevevents-date_format-start">from %s</span>', Eab_EventsHub::TEXT_DOMAIN), date_i18n(get_option('date_format'), $start), date_i18n(get_option('time_format'), $start))
    			;
    			$end_string = $event->has_no_end_time($key)
    				? sprintf(__('<span class="wpmudevevents-date_format-end">to %s</span><br />', Eab_EventsHub::TEXT_DOMAIN), '<span class="wpmudevevents-date_format-end_date">' . $end_date_str . '</span>')
    				: sprintf(__('<span class="wpmudevevents-date_format-end">to %s</span><br />', Eab_EventsHub::TEXT_DOMAIN), '<span class="wpmudevevents-date_format-end_date">' . $end_date_str . '</span> <span class="wpmudevevents-date_format-end_time">' . date_i18n(get_option('time_format'), $end) . '</span>')

    I replaced "On" with "When is it?" and it worked like charm.

    PS : Core modifications in the plugins are not suggested as they would be overwritten with any plugin update.

    Cheers
    PC

  • Kimberly

    Hi!

    Just checking in :slight_smile:

    I'm guessing that because we haven't heard back from you that you've got your issue worked out via live chat or email, or that we have reached the end of our convo here. If you are still having problems or need any other answers on this particular topic please feel free to come back to this thread at anytime. Just be sure to mark it Not Resolved so we don't miss it!

    This ticket is only being Resolved due to lack of activity. It is by no means an action to avoid, brush off or minimize your issue. We are ready and here if you want to re-open at any time and I apologize in advance for any lack of communication if this ticket is being closed in error.

    Thanks for being part of the WPMU DEV Community!

    Best,
    Kimberly

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.