public function convertDate($date, $from = null, $to = 'Y-m-d')
    {
        if (!$date) {
            return null;
        }
        if ($from === null) {
            $from = $this->app->getConfig('locale/date', null);
        }
        if ($from === null) {
            // no format configured, so use our best guess. Will work with Y-m-d
            $date = new DateTime($date);
        } else {
            $date = date_create_from_format($from, (string) $date);
        }
        if ($to === null) {
            $to = $this->app->getConfig('locale/date', 'Y-m-d');
        }

        if ($date === false) {
            throw $this->exception('Date format is not correct');
        }

        return date_format($date, $to);
    }