Java tutorial
//package com.java2s; /** * @copyright Urucas * @license Copyright (C) 2013. All rights reserved * @version Release: 1.0.0 * @link http://urucas.com * @developers Bruno Alassia, Pamela Prosperi */ import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static Date string2Date(String sd, String formato) { //formato = "yyyy-MM-dd'T'HH:mm:ss'Z'"; //"Thu Jul 11 12:40:18 GMT-03:00 2013" //"EE MMM dd HH:mm:ss z YYYY" SimpleDateFormat format = new SimpleDateFormat(formato); try { Date date = (Date) format.parse(sd); return date; } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; } }