Java Parse Date Pattern YYYY parse2DateString(String date)

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

Description

parse Date String

License

Open Source License

Declaration

public static String parse2DateString(String date) 

Method Source Code


//package com.java2s;
/*//from  www .jav  a2 s  . co  m
 * ===========================================================================
 * Copyright 2007 WEBTRANING Corp. All Rights Reserved.
 * WEBTRANING PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 * ===========================================================================
 * @version 1.0, 2007-8-11
 * @author  Jack Chen 
 * ===========================================================================
 * 
 */

import java.text.DateFormat;

import java.text.ParseException;

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static String parse2DateString(String date) {
        DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
        Date d = null;
        try {
            d = df.parse(date);
        } catch (ParseException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return df.format(d);
    }
}

Related

  1. parse(String text)
  2. parse(String text)
  3. parse(String time)
  4. parse(String time, String df)
  5. parse1(String DateString, String dateTimeSeparator)
  6. parse_default(String time)
  7. parseApplePurchaseDate(String dateStr)
  8. parseArgument(String textDate)
  9. parseAscTime(String date)