wp_exif_date2ts()WP 2.5.0

Converts the exif date format to a unix timestamp.

No Hooks.

Return

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

Usage

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

Changelog

Since 2.5.0 Introduced.

wp_exif_date2ts() code WP 6.6.2

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

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