Java Parse Date Pattern YYYY parseSalesDate(final String ymd)

Here you can find the source of parseSalesDate(final String ymd)

Description

parse Sales Date

License

Open Source License

Declaration

public static Date parseSalesDate(final String ymd) 

Method Source Code


//package com.java2s;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static final String H_DATE_FROMAT = "yyyyMMdd";

    public static Date parseSalesDate(final String ymd) {

        if (ymd == null || ymd.isEmpty()) {
            return null;
        }//from w w  w .  j  a  v  a2s .co m

        final DateFormat dateFormat = new SimpleDateFormat(H_DATE_FROMAT);
        Date tmp;
        try {
            tmp = dateFormat.parse(ymd);
        } catch (ParseException e) {
            return null;
        }
        return tmp;
    }
}

Related

  1. parserDate(String str)
  2. parseRegExcelNumber(String number)
  3. parseResponseDate(String date)
  4. parseRoundTripDateString(String roundTripString)
  5. parseRSSDate(String dateStr)
  6. parseSecureDate(final String dateString)
  7. parseSegKeyDate4Display(String source)
  8. parseSessionTime(String response)
  9. parseSilently(String p_string)