use Carbon\Carbon; $dateTime = Carbon::createFromTime(14, 30, 0); echo $dateTime->toDateTimeString(); // outputs "2022-02-15 14:30:00"
use Carbon\Carbon; $time = Carbon::createFromTime(9, 0, 0, 'Europe/London'); echo $time->toDateTimeString(); // outputs "2022-02-15 09:00:00"In this example, we are creating a new date/time object for February 15, 2022 at 9:00am in the Europe/London timezone. We pass in the hour (9), minute (0), and second (0) as arguments to the `createFromTime` method, along with the timezone string. In these examples, we are using the Carbon package library.