1

I collect a date via the HTML5 input field type=date. Saved in a php variable. The format is: yyyy-mm-dd

I want to convert it via php to this, for example: 24 September 2014

It is for a wp shortcode.

Does anyone have an idea? Mayboe there is a way with js/jquery before it is saved to the variable.

HTML:

<div class="section clearfix">
    <label for="accordion-date">Title</label>
    <input type="date" id="accordion-date" name="accordion-date" value="" />
</div>

PHP:

function afo_accordion_shortcode($atts, $content = null) {

extract(shortcode_atts(array(
    'title' => 'The Accordion Panel Title goes here.',
    'date' => '',
), $atts));

return '<div class="accordion-container"><h5 class="accordion-toggle"><span class="toggle-icon"><i class="fa fa-angle-down fa-1x"></i></span>' . $title . '<span class="afo-float-right afo-color-1">' . $date . '</span></h5><div class="accordion-content"><p>' . do_shortcode($content) . '</p></div></div>';

}

add_shortcode('accordion', 'afo_accordion_shortcode');
0

1 Answer 1

2

How about something like this in PHP:

$originalDate = "2014-10-15";
$newDate = date("d F Y", strtotime($originalDate));
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.