Java String to Date numberToDate(String dateString)

Here you can find the source of numberToDate(String dateString)

Description

number To Date

License

Open Source License

Declaration

public static Date numberToDate(String dateString) 

Method Source Code

//package com.java2s;
/*/*w w w.j ava 2  s .  com*/
 * ==================================================================
 * The Huateng Software License
 *
 * Copyright (c) 2008-2012 TOPSCF  All rights reserved.
 * ==================================================================
 */

import java.text.ParseException;
import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {

    public static Date numberToDate(String dateString) {

        if ("".equals(dateString) || dateString == null) {
            return null;
        }
        Date date = null;
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
        try {
            date = simpleDateFormat.parse(dateString);
        } catch (ParseException e) {
            e.printStackTrace();
            System.out.println("------SCFDataFormat>>StringTodate error="
                    + e);
        }
        return date;
    }
}

Related

  1. getTodateString()
  2. humanDateToDate(String date)
  3. LongToDateString(long l)
  4. longToDateString(long l)
  5. longToDateStringDefault(long time)
  6. putTimeStr14ToDate(String dateTimeStr)
  7. putTimeStr19ToDate(String dateTimeStr19)
  8. rfc3339ToDate(String s)
  9. SortStringToDate(String thisdate, Locale locale)