Parsing date with Joda API

后端 未结 2 652
时光说笑
时光说笑 2021-01-25 02:59

I have a string which contains a date \"25 December 1985\". How to parse it using Joda API?

DateTime dt = new DateTime(\"25 December 1985\");
System.out.println(         


        
2条回答
  •  隐瞒了意图╮
    2021-01-25 03:43

    Try this:

    DateTimeFormatter dtf = DateTimeFormat.forPattern("dd MMMM YYYY").withLocale(Locale.ENGLISH);
    DateTime dt = dtf.parseDateTime("25 December 1985");
    System.out.println(dt.getDayOfWeek());
    

提交回复
热议问题