WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. BIOSTALL
    Member
    Posted 9 months 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 :)

    http://wordpress.org/plugins/acf-field-date-time-picker/

  2. nyodulf
    Member
    Posted 9 months ago #

    nevermind =(

  3. esmi
    Forum Moderator
    Posted 9 months 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
    Member
    Posted 9 months 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.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.