Here you can find the source of stringToDate(String str, String formatStr)
Parameter | Description |
---|---|
str | str |
formatStr | formatStr |
Parameter | Description |
---|
public static Date stringToDate(String str, String formatStr) throws ParseException
//package com.java2s; import java.text.*; import java.util.*; public class Main { /**/*from w w w . ja v a 2 s . c om*/ * stringToDate. * @param str str * @param formatStr formatStr * @return Date * @throws java.text.ParseException */ public static Date stringToDate(String str, String formatStr) throws ParseException { DateFormat format = new SimpleDateFormat(formatStr); return format.parse(str); } }