Java Utililty Methods Date Parse

List of utility methods to do Date Parse

Description

The list of methods to do Date Parse are organized into topic(s).

Method

DategetDateFromText(String dateStr)
get Date From Text
if (dateStr != null && (!dateStr.isEmpty())) {
    SimpleDateFormat formatter = new SimpleDateFormat(SIMULATOR_DATE_FORMAT);
    Date startDate = null;
    try {
        startDate = formatter.parse(dateStr);
    } catch (ParseException e) {
        e.printStackTrace();
    } finally {
...
StringgetDateFromTimestamp(String time, String pattern)
get Date From Timestamp
String date = new SimpleDateFormat(pattern).format(new Date(Long.parseLong(time) * 1000));
return date;
DategetDateFromUPnP(String dateString)
Creates a date time value from a string appropriate for UPnP (e.g., 2006-10-27 12:00:00).
try {
    return upnpDate.parse(dateString);
} catch (Exception e) {
return null;
DategetDateFromUTC(String utcFormat)
get Date From UTC
SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd'T'HHmmss'Z'");
ParsePosition pos = new ParsePosition(0);
Date strtodate = formatter.parse(utcFormat, pos);
if (strtodate == null) {
    strtodate = new Date();
return strtodate;