• BIOSTALL

    (@biostall)


    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 ??

    https://www.ads-software.com/plugins/acf-field-date-time-picker/

Viewing 3 replies - 1 through 3 (of 3 total)
  • nyodulf

    (@nyodulf)

    nevermind =(

    esmi

    (@esmi)

    @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.

    nyodulf

    (@nyodulf)

    @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.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Format dd/mm/yy doesn't work’ is closed to new replies.