wp_exif_date2ts( string $str ): int|false

In this article

Converts the exif date format to a unix timestamp.

Parameters

$strstringrequired
A date string expected to be in Exif format (Y:m:d H:i:s).

Return

int|false The unix timestamp, or false on failure.

Source

function wp_exif_date2ts( $str ) {
	list( $date, $time ) = explode( ' ', trim( $str ) );
	list( $y, $m, $d )   = explode( ':', $date );

	return strtotime( "{$y}-{$m}-{$d} {$time}" );
}

Changelog

VersionDescription
2.5.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.