Page tree

Welcome to FreeSoftwareServers Confluence Wiki

Skip to end of metadata
Go to start of metadata

http://stackoverflow.com/questions/42450623/php-find-file-in-directory-based-on-date-year-month-day-but-not-based-on-cu/42450715?noredirect=1#comment72045428_42450715

<?php
$d = date_parse_from_format("Y-m-d H:i:s", "2017-02-22 16:24:12");
$ds = sprintf("/base/%d/%02d/%d", $d['year'], $d['month'], $d['day']);
echo $ds;
?>
<?php

$dateString = '2017-02-22 16:24:12';
$base = "/monitor/";

$path = "$base".date('Y/m/d/',strtotime("$dateString"));

echo $path;

?>
  • No labels

1 Comment