Java Date Parse asDate(String s)

Here you can find the source of asDate(String s)

Description

as Date

License

Open Source License

Declaration

static Date asDate(String s) throws ParseException 

Method Source Code

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

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {
    static final ThreadLocal<SimpleDateFormat> FMT_TRADE_DATE = new ThreadLocal<SimpleDateFormat>() {
        protected SimpleDateFormat initialValue() {
            return new SimpleDateFormat("\"MM/dd/yyyy\""); //$NON-NLS-1$
        }//from   w  w w . j ava  2  s.  c om
    };

    static Date asDate(String s) throws ParseException {
        if ("\"N/A\"".equals(s)) //$NON-NLS-1$
            return null;
        return FMT_TRADE_DATE.get().parse(s);
    }
}

Related

  1. asDate(final long time)
  2. asDate(final Map map, final String key)
  3. asDate(final String literal)
  4. asDate(String date)
  5. asDate(String param, SimpleDateFormat format)
  6. asDate(String string)
  7. asDate(String value, String format)
  8. convertDateForExcel(String timestamp)
  9. convertDateFromString(String data)