To list the files exists in more ways, as pointed out in the other answers.
In any case, you will have to extract the portion that refers to the date, position, or regular expression.
$arquivo = 'nome_2015-11-13_01.42.22_.csv';
$prefixo = 'nome_';
$dataHora = substr(strlen($prefixo), 19);
To convert to date you have two ways:
1 - with the function DateTime::createFromFormat
(PHP required = 5.3.0), in this case an object will be returned DateTime
DateTime::createFromFormat('Y-m-d_H.i.s', $dataHora)
2 - with strtotime
, you will need to convert the format, changing the _
by T
, according to the [compound formats] accepted, which returns a time stamp : / p>
strtotime($dataHora, str_replace('_', 'T', $dataHora));