public static function datetimeToMysql($p_date, $p_withSeconds = false, $p_withHour = true)
    {
        $format = 'Y-m-d';
        if ($p_withSeconds && $p_withHour) {
            $format = 'Y-m-d H:i:s';
        } else {
            if ($p_withHour) {
                $format = 'Y-m-d H:i';
            }
        }
        return $p_date->format($format);
    }