Mega Code Archive

 
Categories / Java Tutorial / Data Type
 

Parse with a custom format

import java.text.Format; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; public class Main {   public static void main(String[] argv) throws Exception {     Format formatter = new SimpleDateFormat("HH:mm:ss Z", Locale.CANADA);     Date date = (Date) formatter.parseObject("21:44:07 Heure normale du Pacifique");   } }