fork download
  1. import java.text.ParseException;
  2. import java.text.SimpleDateFormat;
  3. import java.util.Date;
  4. import java.util.Locale;
  5. import java.util.TimeZone;
  6.  
  7. public class Main {
  8. public static void main(String[] args) {
  9. SimpleDateFormat fmt = new SimpleDateFormat("dd MMM yyyy HH:mm:ss", Locale.GERMAN);
  10. fmt.setLenient(false);
  11. fmt.setTimeZone(TimeZone.getTimeZone("Europe/Berlin"));
  12. try {
  13. Date date = fmt.parse("08 März 2015 02:15:20");
  14. System.out.println(fmt.format(date));
  15. } catch (ParseException e) {
  16. e.printStackTrace();
  17. }
  18. }
  19. }
Success #stdin #stdout 0.17s 53400KB
stdin
Standard input is empty
stdout
08 März 2015 02:15:20