How do I get localized date pattern string?

前端 未结 10 2312
死守一世寂寞
死守一世寂寞 2020-11-28 05:31

It is quite easy to format and parse Java Date (or Calendar) classes using instance of DateFormat, i.e. I could format current date into short localize date like this:

10条回答
  •  囚心锁ツ
    2020-11-28 06:08

    Im not sure about what you want, but...

    SimpleDateFormat example:

    SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yy");
    Date date = sdf.parse("12/31/10");
    String str = sdf.format(new Date());
    

提交回复
热议问题