Java Parse Date Pattern YYYY parseDisplay4Key(Object date)

Here you can find the source of parseDisplay4Key(Object date)

Description

dd/MM/yyyy -> yyyyMMdd

License

Open Source License

Parameter

Parameter Description
date a parameter

Exception

Parameter Description
ParseException an exception

Declaration

public static Object parseDisplay4Key(Object date) throws ParseException 

Method Source Code


//package com.java2s;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {
    private static SimpleDateFormat sdf4Key = new SimpleDateFormat("yyyyMMdd");
    private static SimpleDateFormat sdf4Display = new SimpleDateFormat("dd/MM/yyyy");

    /**//ww w  .  j  a v a2  s  .  c o  m
     * dd/MM/yyyy -> yyyyMMdd
     * 
     * @param date
     * @return
     * @throws ParseException
     */
    public static Object parseDisplay4Key(Object date) throws ParseException {
        return format4Key(sdf4Display.parse(date.toString()));
    }

    /**
     * yyyyMMdd
     * 
     * @param date
     * @return
     */
    public static String format4Key(Date date) {
        return sdf4Key.format(date);
    }
}

Related

  1. parseCoTDate(String dateString)
  2. parseDatabaseDate(String dateString)
  3. parseDD(String dateStr)
  4. parseDelayTime(String time)
  5. parseDIGTime(String timestr)
  6. parseDT(String fmt, String timeline)
  7. parseDueDate(String date)
  8. parseEapoDate(String date)
  9. parseEuropeanDateAnd12HrsTimeString(String aDateString, String aTimeString)