I've a date in the following format 

```
$date = "6.17.2019 12:00:00 AM."

```

I need to convert this into Y-m-d h:i:s.
I tried the following line of code,

```
$regdate = \Carbon\Carbon::parse($date)->format('Y-m-d h:i:s');

```

But it results in error.

> 
> DateTime::\_\_construct(): Failed to parse time string (6.17.2019 12:00:00 AM.) at position 7 (1): Unexpected character"
> 
> 
> 

Desired output is :

> 
> 2019-06-17 00:00:00
> 
> 
>