Here you can find the source of dayForMonth(String pTime)
public static int dayForMonth(String pTime) throws Exception
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { public static int dayForMonth(String pTime) throws Exception { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); Calendar c = Calendar.getInstance(); c.setTime(format.parse(pTime));//from ww w. ja v a 2 s.co m int m = c.get(Calendar.DAY_OF_MONTH); return m; } }