Java Parse Date Pattern YYYY parse(String date)

Here you can find the source of parse(String date)

Description

parse

License

Apache License

Declaration

public static Date parse(String date) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;

public class Main {
    private static final String SYSTEM_DATE_FORMAT = "dd/MM/yyyy HH:mm";
    public static final String TIME_ZONE = "CST";

    public static Date parse(String date) {
        try {//from  ww  w.  java2 s  .  c  o  m
            SimpleDateFormat format = getDateTimeFormat();
            return format.parse(date);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return null;
    }

    private static SimpleDateFormat getDateTimeFormat() {
        SimpleDateFormat dateFormat = new SimpleDateFormat(SYSTEM_DATE_FORMAT);
        dateFormat.setTimeZone(TimeZone.getTimeZone(TIME_ZONE));
        return dateFormat;
    }
}

Related

  1. parse(String date)
  2. parse(String date)
  3. parse(String date)
  4. parse(String date)
  5. parse(String date)
  6. parse(String date)
  7. parse(String date)
  8. parse(String date)
  9. parse(String date)