Adjust rng datetime

This commit is contained in:
Dennis Eichhorn 2017-10-07 00:07:30 +02:00
parent 043b0c70fe
commit df6c8dc48f
2 changed files with 6 additions and 9 deletions

View File

@ -82,7 +82,7 @@ class Directory extends FileAbstract implements DirectoryInterface
$list = []; $list = [];
foreach (glob($path . DIRECTORY_SEPARATOR . $filter) as $filename) { foreach (glob($path . DIRECTORY_SEPARATOR . $filter) as $filename) {
$list[] = $filename; $list[] = str_replace(['/\\', '\\'], ['/', '/'], $filename);
} }
return $list; return $list;

View File

@ -28,20 +28,17 @@ class DateTime
{ {
/** /**
* Get a random string. * Get a random \DateTime.
* *
* @param string $start Start date * @param \DateTime $start Start date
* @param string $end End date * @param \DateTime $end End date
* *
* @return \DateTime * @return \DateTime
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public static function generateDateTime(string $start, string $end) : \DateTime public static function generateDateTime(\DateTime $start, \DateTime $end) : \DateTime
{ {
$startDate = strtotime($start); return new \DateTime(date('Y-m-d H:i:s', mt_rand($startDate->getTimestamp(), $endDate->getTimestamp())));
$endDate = strtotime($end);
return new \DateTime(date('Y-m-d H:i:s', mt_rand($startDate, $endDate)));
} }
} }