Android examples for java.util:Year
get Current Year End Time
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { private final static SimpleDateFormat shortSdf = new SimpleDateFormat( "yyyy-MM-dd"); private final static SimpleDateFormat longSdf = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss"); public static Date getCurrentYearEndTime() { Calendar c = Calendar.getInstance(); Date now = null;/*from ww w . j ava 2s .c o m*/ try { c.set(Calendar.MONTH, 11); c.set(Calendar.DATE, 31); now = longSdf.parse(shortSdf.format(c.getTime()) + " 23:59:59"); } catch (Exception e) { e.printStackTrace(); } return now; } }