Java yyyy formatDateToString(String strDate)

Here you can find the source of formatDateToString(String strDate)

Description

format Date To String

License

Open Source License

Declaration

public static Date formatDateToString(String strDate) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static Date formatDateToString(String strDate) {
        Date date = null;/*from  ww w .j a v a 2s . c  o m*/
        try {
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            date = sdf.parse(strDate);
        } catch (Exception e) {
            date = new Date();
        }
        return date;
    }
}

Related

  1. formatDateAsShortDateLocalTime(Date moonDate, TimeZone tz)
  2. formatDateFromStringToString(String str)
  3. formatDateNoTime(Date date)
  4. formatDateString(java.util.Date date, String format)
  5. formatDateToString(Date d)
  6. formatDicomDate(String dicomDate)
  7. formatearDateToString(Date date)
  8. formatFecha(Date fecha)
  9. formatFromDate(Date date)