Parse a date and time with yyyy.MM.dd.HH.mm.ss format in Java
Description
The following code shows how to parse a date and time with yyyy.MM.dd.HH.mm.ss format.
Example
//from w w w . ja va 2 s . c om
import java.text.Format;
import java.text.SimpleDateFormat;
import java.util.Date;
public class Main {
public static void main(String[] argv) throws Exception {
Format formatter = new SimpleDateFormat("yyyy.MM.dd.HH.mm.ss");
Date date = (Date) formatter.parseObject("2002.01.29.08.36.33");
System.out.println(date);
}
}
The code above generates the following result.