0

Shouldn't this code display the date provided from the META BOX date picker input field according to the language chosen?

Explanation:

The Meta Box value that is coming in though rwmb_meta() is always dd.mm.y, e.g. 06.02.16. So according to the language tags it should change the format (it does) and the (internationalizedly) right language of the date (not important in this example since it's all numbers, but it will be). But it always shows the current time...

Why? And how can I fix it?

<?php 

    $entered_start = rwmb_meta( "exhibition_meta_beginn" );

    _e("[:en]".date_i18n("m/d/y",strtotime($entered_start))."[:de]".date_i18n("d.m.y",strtotime($entered_start))."[:]");

    ?>–<?php

    $entered_end = rwmb_meta( "exhibition_meta_ende" );

    _e("[:en]".date_i18n("m/d/y",strtotime($entered_end))."[:de]".date_i18n("d.m.y",strtotime($entered_end))."[:]");

?>
0

For some reason, strtotime didn't recognise the date format d.m.y. m/d-y is save. Then it worked.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.