Example usage for java.text ParseException printStackTrace

List of usage examples for java.text ParseException printStackTrace

Introduction

In this page you can find the example usage for java.text ParseException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:Main.java

public static Date String2Date(String date) {
    Date DateTime = new Date();
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.CHINESE);
    try {/* w  w  w  . ja va  2 s. c om*/
        DateTime = sdf.parse(date);
    } catch (ParseException e) {
        e.printStackTrace();
    }
    return DateTime;
}

From source file:Main.java

public static Date date(String date) {
    SimpleDateFormat format = new SimpleDateFormat("dd-MMM-yyyy");
    Date value = null;/*  w  w  w  . j a v  a 2s  .c  o  m*/
    try {
        value = format.parse(date);
    } catch (ParseException e) {
        e.printStackTrace();
    }
    return value;
}

From source file:Main.java

public static DateTime format(String date) {
    try {//  w  w  w.j  a  v a 2 s. c  o m
        return new DateTime(RFC822Formatter.parse(date));
    } catch (ParseException e) {
        e.printStackTrace();
    }
    return null;
}

From source file:Main.java

public static long getTimeMilliSec(String timeStamp) {
    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    try {/*  w ww .j  a  v  a2  s  .c  o  m*/
        Date date = format.parse(timeStamp);
        return date.getTime();
    } catch (ParseException e) {
        e.printStackTrace();
    }
    return 0;
}

From source file:Main.java

public static Date getFormatDate2(String date) {
    SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
    Date date0 = null;// ww w. j  av a  2 s.  c  om
    try {
        date0 = sdf.parse(date);
    } catch (ParseException e) {
        e.printStackTrace();
    }
    return date0;
}

From source file:Main.java

public static void setDataMask(JFormattedTextField textField) {
    try {/*from   w ww .jav a  2 s  . co m*/
        MaskFormatter mask = new MaskFormatter("##/##/####");
        textField.setFormatterFactory(new DefaultFormatterFactory(mask));
    } catch (ParseException e) {
        e.printStackTrace();
    }

}

From source file:Main.java

@SuppressLint("SimpleDateFormat")
public static long time2Mills(String time) {
    SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    try {//www . j  ava2s . c om
        return sdf2.parse(time).getTime();
    } catch (ParseException e) {
        e.printStackTrace();
    }
    return System.currentTimeMillis();
}

From source file:Main.java

public static String formatTime(String time, String pattern) {
    SimpleDateFormat format = new SimpleDateFormat(pattern);
    try {/*  ww  w. j  av a2  s .  c o m*/
        Date date = format.parse(time);
        return format.format(date);
    } catch (ParseException e) {
        e.printStackTrace();
    }
    return "";
}

From source file:Main.java

public static Date dateXMLStringToDateParser(String sDate) {
    Date date = null;//from  ww w.j a  v  a2  s .  co m
    try {
        SimpleDateFormat formatter = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z", Locale.US);
        date = formatter.parse(sDate);
    } catch (ParseException e) {
        e.printStackTrace();
    }
    return date;
}

From source file:Main.java

public static Date getFormatDate(int year, int month, int day) {
    String strDate = year + "-" + month + "-" + day;
    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
    try {/*from   w w  w .ja va 2 s.com*/
        return format.parse(strDate);
    } catch (ParseException e) {
        e.printStackTrace();
    }
    return null;
}