Here you can find the source of toDate(String dateToConvert)
Parameter | Description |
---|---|
dateToConvert | a parameter |
Parameter | Description |
---|---|
ParseException | an exception |
public static Date toDate(String dateToConvert) throws ParseException
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { /**//from w w w . j a v a 2s . co m * This function takes a timezone string and converts it to a Java Date * @param dateToConvert * @return * @throws ParseException */ public static Date toDate(String dateToConvert) throws ParseException { SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); Date date = formatter.parse(dateToConvert); return date; } }