Support

Home Forums Event Espresso Premium Change START DATE Date Format

Change START DATE Date Format

Posted: September 5, 2013 at 3:49 am


Klaus M

September 5, 2013 at 3:49 am

how can i change the DATE FORMAT TO (‘l, d. F Y’) in this query:

<?php
$key_1_value = get_post_meta( get_the_ID(), ‘event_start_date’, true );
// check if the custom field has a value
if( ! empty( $key_1_value ) ) {
echo $key_1_value;
}
?>

Changes in Setting > General, under Date Format have no effect ;(


Dean

September 5, 2013 at 4:16 am

Well if the date is in a standard input you could use something like this

http://stackoverflow.com/questions/2487921/convert-date-format-yyyy-mm-dd-dd-mm-yyyy


Klaus M

September 5, 2013 at 5:35 am

Wohoo! Works, thanks. But these dates are displayed in english while other dates (like <?php the_date(‘l, d. F Y’); ?>) are shown in German? I need all dates in German. Any idea? Thanks!


Dean

September 5, 2013 at 6:26 am

It depends on what you are trying to do, there may be an overall simpler way.

However to answer your question, I am assuming it is pulling the date in as the default English, and as it isnt being marked for translation it isnt being translated.

I havent tested this but you could perhaps use the gettext filter http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext


Klaus M

September 5, 2013 at 7:01 am

<?php $ee_event_start_date = date_i18n(‘l, d. F Y’, strtotime(get_post_meta( get_the_ID(), ‘event_start_date’, true )));?>

date_i18n instead of date gets the timestamp according to wp settings. thanks!

RESOLVED 🙂

The support post ‘Change START DATE Date Format’ 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.

Event Espresso