WordPress at Your Fingertips
function is not described

WC_Product_CSV_Importer::parse_date_field() public WC 1.0

Parse dates from a CSV. Dates requires the format YYYY-MM-DD and time is optional.

{} It's a method of the class: WC_Product_CSV_Importer{}

No Hooks.

Return

String|null.

Usage

$WC_Product_CSV_Importer = new WC_Product_CSV_Importer();
$WC_Product_CSV_Importer->parse_date_field( $value );
$value(string) (required)
Field value.

Code of WC_Product_CSV_Importer::parse_date_field() WC 5.8.0

public function parse_date_field( $value ) {
	if ( empty( $value ) ) {
		return null;
	}

	if ( preg_match( '/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])([ 01-9:]*)$/', $value ) ) {
		// Don't include the time if the field had time in it.
		return current( explode( ' ', $value ) );
	}

	return null;
}