Android Date String Parse getDateFromString(String format, String dateString)

Here you can find the source of getDateFromString(String format, String dateString)

Description

get Date From String

License

Open Source License

Declaration

public static Date getDateFromString(String format, String dateString)
        throws ParseException 

Method Source Code

//package com.java2s;
/**/*from  www  . ja  v  a2  s . co  m*/
 * Copyright (c) 2012 The Wiseserc. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

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

public class Main {

    public static Date getDateFromString(String dateString)
            throws ParseException {
        SimpleDateFormat sdf = new SimpleDateFormat(
                "yyyy-MM-dd'T'hh:mm:ss.S'Z'");
        return sdf.parse(dateString);
    }

    public static Date getDateFromString(String format, String dateString)
            throws ParseException {
        SimpleDateFormat sdf = new SimpleDateFormat(format);
        return sdf.parse(dateString);
    }
}

Related

  1. convertDate(String YearMonthDay)
  2. convertDateStringToDash(String MonthDayYear)
  3. convertDateStringToLong(String date, String format)
  4. convertDateTime( String YearMonthDayHourMinuteSeconds)
  5. convertToDate(String dateString)
  6. getDateFromLJString( String dateString)
  7. getDateFromString(String dateString)
  8. parseRFC3339Date(String date)
  9. parseRFC822Date(String date)