I have a form in which I have integrated calender field :
Publish date and Unpublish date
When I am sbmitting this form I have Publish date = 1/18/2017 and unpublish date = 1/19/2017;
In Controller i am making custom time
$pubdate = strtotime("$publish_date 00:00:00");
$unpdate = strtotime("$publish_date 23:59:59");
In db it's saving wrong date
select from_unixtime(publish_date) as a , from_unixtime(unpublish_date) as b from banner ;
output :
'2017-01-18 05:30:00.000000', '2017-01-20 05:29:00.000000'
where I'm doing wrong
Or is there any way to save the time :
Like publish date = 01/18/2017
(m/d/Y) it should become 01/18/2017 00:00:00
and save it in db like : 1551398401
output :
'2017-01-18 05:30:00.000000', '2017-01-20 05:29:00.000000'
object(DateTime)[2]
public 'date' => string '2017-01-18 05:30:00.000000' (length=26)
public 'timezone_type' => int 3
public 'timezone' => string 'UTC' (length=3)
This is how it stores in database. To display this
<?php
echo date_format($dbdate, 'd/m/y H:i:s'); //Output: 01/18/2017 00:00:00
?>