亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

Convert string to date in Laravel
P粉270891688
P粉270891688 2023-09-07 11:41:49
0
1
1516

I have a string representing a date. I want to store it in my database but the problem is that in my database the property is defined as date. How to correctly convert a string to a date so it can be stored in the database? This is how my string looks like: "fecha":"31 March 2023" . Thanks.

P粉270891688
P粉270891688

reply all(1)
P粉134288794

You can use the strtotime() function to convert any English text datetime description to a unix timestamp, and using the date() function you can format a unix timestamp. You can use both like this:

$date = date('Y-m-d',strtotime($string));

You can write it into a mutator, or you can check out the date conversion article in the documentation:

Date Conversion Document

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template