Date and Time Picker Field
Format dd/mm/yy doesn't work (4 posts)

    Posted 2 years ago #

    I'm using the date format dd/mm/yy, however after saving the date either disappeared or came back in the wrong format. For example, saving 06/11/2013 would come back as 11/06/2013.

    The problem is because the plugin uses the strtotime() PHP function which assumes the day and month be in a specific order. As a result I changed the update_value() function in file date_time_picker-v4.php as follows:

    function update_value( $value, $post_id, $field ) {
    		$field = array_merge($this->defaults, $field);
    		if ($value != '' && $field['save_as_timestamp'] == 'true') {
    			if ($field['date_format'] == 'dd/mm/yy')
    				$value = str_replace('/', '-', $value);
    			$value = strtotime( $value );
    		return $value;

    Otherwise, great plugin :)


  2. nyodulf
    Posted 2 years ago #

    nevermind =(

  3. esmi
    Forum Moderator
    Posted 2 years ago #

    @nyodulf: It is impolite to interrupt another poster's ongoing thread unless you are posting a solution or suggestion. It causes significant problems for the forum's volunteers and prevents us from being able to track issues by topic. Please post your own topic.

  4. nyodulf
    Posted 2 years ago #

    @esmi: I do apologise, but that's not what happened. I had posted a suggestion, but I've been up working all night and didn't realise that my suggestion was negated by info in the OP. My 'nevermind' was me editing my post. I would have deleted it if it were possible.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Date and Time Picker Field
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.