We would like to know how to get the current system month by java.sql.date.
import java.util.Calendar; //from w w w .j a va 2s . c om public class Main { public static void main(String[] args) { String[] months = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }; Calendar cal = Calendar.getInstance(); String month = months[cal.get(Calendar.MONTH)]; System.out.println("Month name: " + month); } }
The code above generates the following result.