mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-06 20:48:40 +00:00
Adjust rng datetime
This commit is contained in:
parent
043b0c70fe
commit
df6c8dc48f
|
|
@ -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;
|
||||||
|
|
|
||||||
|
|
@ -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)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user