This is the sample request date Wed Feb 02 2022 00:00:00 GMT 0800 (Singapore Standard Time)
I want to convert to this format 2022-02-19
.
CodePudding user response:
$begin_date = 'Wed Feb 02 2022 00:00:00 GMT 0800';
$timestamp = strtotime($begin_date);
$my_date = date('Y-m-d', $timestamp);
echo $my_date;