1
votes

I am using the following code.

$request->hour= 10:00:00
$parameters->hour=strtotime(date(" H:i:s",$request->hour));

I am getting the following error.

A non well formed numeric value encountered

2

2 Answers

2
votes

Try $parameters->hour=date("H:i:s",strtotime($request->hour));

or if you want $parameters->hour=strtotime(date("H:i:s",strtotime($request->hour)));

1
votes

Well you have to try this:

$hour = "10:00:00";
$parameters->hour = strtotime(date("H:i:s",strtotime($hour)));

or you can use carbon

\Carbon\Carbon::parse($hour)->format("H:i:s");