Format Unix Time to display only Data

2

Good afternoon, I'm having a problem where I need to remove the time or set the end time always to 23:59:59

if($form)
    {
        $start = new \DateTime($form['startDate']);
        $start = $start->format('U');

        $end = new \DateTime($form['endDate']);
        $end = $end->format('U');
    }

    $start = isset($start) ? $start : (time() - ((60*60*24)*30));
    $end   = isset($end) ? $end : time();

Does anyone know how I can format Unix Time?

    
asked by anonymous 10.06.2014 / 20:38

1 answer

4

Instead of using the U format, which is just the Unix Timestamp , you can use Y-m-d :

$start = $start->format('Y-m-d');

See how Format the date in PHP.

    
10.06.2014 / 20:48