If you think the Android project myToDo listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
package com.gutspot.apps.android.mytodo.utils;
/*www.java2s.com*/import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
publicclass DateTimeUtil {
publicstaticlong millisecondOf(int year, int month, int day, int hour, int minute) {
try {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd mm:ss", Locale.getDefault());
Date date = format.parse("" + year + "-" + (month + 1) + "-" + day + " " + hour + ":" + minute);
return date.getTime();
} catch (ParseException e) {
android.util.Log.e("DateTimeUtil#millisecondOf", e.getStackTrace().toString());
thrownew RuntimeException(e);
}
}
publicstaticlong millisecondOf(int year, int month, int day) {
return millisecondOf(year, month, day, 0, 0);
}
}