I am a newbie to programming, my teacher has assigned me a homework, which one part of it is to show the date that entered. I used SimpleDateFormat "dd/MMMM/yyyy". But when is running, It shows the month in the language of my country.
For exam, if I enter 10-02-2001, is will show up 10-tháng 2( february in my country)-2001. I want change it to English. Please help me. (Sorry for my bad English)
The code:
public Date getDate(String msg, String err, String format){
        SimpleDateFormat sdf = new SimpleDateFormat(format);
        Date date = null;
        sdf.setLenient(false);
        while(true){
            try {
                System.out.print(msg);
                String value = input.readLine();
                date = sdf.parse(value);
                Date now = new Date();
                if(date.after(now)){
                    System.out.println("Your input date is bigger than present");
                    continue;
                }
                break;
                
            } catch (IOException | ParseException ex) {
                System.out.println(err);
            }
        }
        return date;
    } 
Date dateInput = validate.getDate("Enter Date: ", "Date invalid", "dd/MM/yyyy");
        
        SimpleDateFormat sdf = new SimpleDateFormat("dd-MMM-yyyy");
        String date = sdf.format(dateInput);
        
        double amount = validate.getDouble("Enter Amount: ", "Please enter a real number", 0, Double.MAX_VALUE);
            
 
     
    