public static void main(String[] args){ DateFormat df = new SimpleDateFormat("YYYY-MMM", Locale.ENGLISH); String time1=df.format(new Date()); System.out.println(time1); }