Here you can find the source of toDate(String s)
Parameter | Description |
---|---|
s | the input string |
public static Date toDate(String s)
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { /**//from w w w.ja v a 2 s .c o m * Parses the date string and returns the date value. * Input format is: <b>dd.MM.yyyy HH:mm:ss</b>. * * @param s the input string * @return the parsed date value, null if input is null or invalid */ public static Date toDate(String s) { Date date = null; try { SimpleDateFormat sdf = new SimpleDateFormat( "dd.MM.yyyy HH:mm:ss"); date = sdf.parse(s); } catch (ParseException e) { e.printStackTrace(); } return date; } }