If I take current date from my application, it comes with variation like below:

**scenario 1:** when the date is less than 10th of the month, a month is less than 10 of the year --> example: 5/9/18  

**scenario 2:** when the date is >= 10th of the month, a month is less >= 10 of the year --> example: 10/11/18

Note: all the examples are in **MM/DD/YY** format and timezone is the USA

```
Calendar cal = Calendar.getInstance();   
cal.add(Calendar.DATE,-2);    
DateFormat dateFormat = new SimpleDateFormat("MM/dd/yy HH:mm a");   
String PastDate = dateFormat.format(cal.getTime());  
info("Date is displayed as : "+ PastDate );

```

The above piece of code throwing me an error when the scenario 1 is in place. But if I format the date-time as "**M/d/yy H:mm a**" it works for both the scenario. I need the date add also.

Will it be a good practice to use the 2nd format? or there is any other way to get it done. Expert guidance please..