the date stored in mysql is in Datetime format 'Y-m-d H:m:s' using laravel eloquent I want to convert Datetime format to date 'Y-m-d' the date stored in mysql table is 2016-11-29 17:23:56 and in the controller to convert I am using the below
$currentdate = Carbon::createFromFormat("Y-m-d H:m:s",$token->IssueDate)->format("Y-m-d");
the result I am getting is "2017-11-29" another example
Mysql record stored date is 2016-12-01 17:27:47 and the result I am getting is "2018-03-01"
Please help what am I missing here.
I have a constructor in the controller
public function __construct()
{
date_default_timezone_set("Asia/Kolkata");
}
which I don't think is a pronblem as after removing I am still getting the same result.