Android Date String to Date Convert toDateFromString(String dateString)

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

Description

to Date From String

Declaration

public static Date toDateFromString(String dateString) 

Method Source Code

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

import java.util.Date;

public class Main {
    public static Date toDateFromString(String dateString) {
        // 1985-04-12T23:20:50.52Z
        SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss a");
        // sd.setTimeZone(TimeZone.getDefault());
        Date date = new Date();
        try {//from   w  w w.  j a  va 2 s  .c o m
            date = sd.parse(dateString);
        } catch (ParseException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        return date;
    }
}

Related

  1. convertDateStringToDate(String dateString)
  2. string2Date(String s, String s1)
  3. stringToDate(SimpleDateFormat dateFormat, String dateToConvert, boolean catchError)
  4. stringToDate(String paramString1, String paramString2, boolean paramBoolean)
  5. toDate(String s)
  6. str2Date(String str)
  7. global2Date(String str)