Back to project page TodoList.
The source code is released under:
Apache License
If you think the Android project TodoList listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package lyc.app; /*from www.j a v a 2 s .c o m*/ import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class DateUtils { private static final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); private DateUtils() { } public static String format(long milliseconds) { return format.format(new Date(milliseconds)); } public static String format(long milliseconds, String formatter) { return format(new Date(milliseconds), formatter); } public static String format(Date date, String formatter) { SimpleDateFormat newFormat = new SimpleDateFormat(formatter); return newFormat.format(date); } public static long parse(String dateStr) { if (dateStr == null) { throw new IllegalArgumentException(); } try { return format.parse(dateStr).getTime(); } catch (ParseException e) { e.printStackTrace(); } return System.currentTimeMillis(); } public static boolean afterToday(String dateStr) { if (dateStr == null) { throw new IllegalArgumentException(); } try { return format.parse(dateStr).after(new Date()); } catch (ParseException e) { e.printStackTrace(); } return false; } }