Reputation: 2662
Is there a way to generate time between, let's say, 00:00:00
and 15:00:00
in Faker? I tried this:
$time = $faker->time( 'H:i:s', '15:00:00' );
but it doesn't seem to work. I keep getting values between 00:00:00
and 23:59:59
Upvotes: 3
Views: 10403
Reputation: 13653
This is possible with Faker now:
$faker->dateTimeBetween($startDate, $endDate);
$startDate
and $endDate
can be string or Carbon instances
Check the date_time provider reference for all available options.
Upvotes: 7
Reputation: 81187
No, there is no way in Faker to achieve limit on the time part.
But forget faker for this little task:
date('H:i:s', rand(1,54000)); // 00:00:00 - 15:00:00
Upvotes: 7