Java tutorial
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String getDateForMouth(String dateString) { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd"); SimpleDateFormat simpledateformat = new SimpleDateFormat("MM-dd"); String s = ""; Date newDate = null; try { newDate = dateFormat.parse(dateString); s = simpledateformat.format(newDate); } catch (ParseException e) { e.printStackTrace(); s = ""; } return s; } }