SimpleDateFormat.parse(String text, ParsePosition pos) has the following syntax.
public Date parse(String text, ParsePosition pos)
In the following code shows how to use SimpleDateFormat.parse(String text, ParsePosition pos) method.
// ww w. j av a2s. c o m import java.text.Format; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static void main(String[] argv) throws Exception { SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss Z"); Date date = (Date) formatter.parseObject("22:14:02 -0500"); System.out.println(date); } }
The code above generates the following result.