• Resolved augiscp

    (@augiscp)


    Hello,

    i want import csv file and date format is “d/m/y – h:m:s” (example: “17/07/2023 – 19:28:44”.

    how convert for corret import?

Viewing 1 replies (of 1 total)
  • Plugin Author WP All Import

    (@wpallimport)

    Hey @augiscp,

    Doing this would require a custom PHP function to be used. For example:

    function example_convert_date ($date_to_convert = '', $format_to_convert_from = 'd/m/Y', $format_to_convert_to = 'Y-m-d') {
    
    	if ( !empty($date_to_convert) ) {
    		$date = date_create_from_format($format_to_convert_from, $date_to_convert);
    		return date_format($date, $format_to_convert_to);
    	}
    
    }

    You would have to call it like this in the “Post Dates” field (exchanging {date[1]} with the element containing the date to import):

    [example_convert_date({date[1]}, "d/m/Y - H:i:s", "Y-m-d H:i:s")]
Viewing 1 replies (of 1 total)

The topic ‘Date Format for import’ is closed to new replies.