Convert SQL or UTIL DATE to expected format "dd-MMM-yyyy", but not in String value : <p>I have a java util Date object and I need to write it in the format "dd-MMM-yyyy", but not as a String ( it can be sql or util Date, it does not matter ) and I do not understand what I am doing wrong because instead of "Nov" for month, I get "11". The right output is given only when I format to String...</p>

<p>Can anyone help me ? This is what I tried so far and the reason I do not want a String is because I need to use this date as a parameter to run a database query and the field type in sql is Date.</p>

<pre><code>        Date currentDate = new Date(Calendar.getInstance().getTimeInMillis());  output value: Thu Nov 14 17:21:44 EET 2019
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd-MMM-yyyy");
        String formattedDate = simpleDateFormat.format(currentDate);    output value: 14-Nov-2019
        java.util.Date date = simpleDateFormat.parse(formattedDate);    output value: Thu Nov 14 00:00:00 EET 2019
        java.sql.Date sqlStartDate = new java.sql.Date(date.getTime()); output value: 2019-11-14
</code></pre>
