Java yyyy format(String dateString)

Here you can find the source of format(String dateString)

Description

format

License

Apache License

Declaration

public static Date format(String dateString) 

Method Source Code

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

import java.text.ParseException;
import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static SimpleDateFormat dateFormat4 = new SimpleDateFormat(
            "yyyy-MM-dd");

    public static Date format(String formatString, String dateString) {
        try {/*from ww  w  .  j av a  2s  .  c  om*/
            return (new SimpleDateFormat(formatString)).parse(dateString);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return null;
    }

    public static Date format(String dateString) {
        try {
            return dateFormat4.parse(dateString);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return null;
    }
}

Related

  1. format(java.util.Date date)
  2. format(java.util.Date date)
  3. format(java.util.Date date, String pattern)
  4. format(Object value, String pattern)
  5. format(ResourceBundle idioma, Date date)
  6. format(String oldPattern, String newPattern, String data)
  7. format2(Date data)
  8. format6chars(Date date)
  9. format6chars(Date date, TimeZone tz)