<分区>
我是 Java 新手。 Postgres 数据库包含的日期格式是 yyyy-MM-dd
。我需要转换为 dd-MM-yyyy
。
我试过了,但是显示的结果不对
public static void main(String[] args) throws ParseException {
String strDate = "2013-02-21";
DateFormat formatter = new SimpleDateFormat("dd-MM-yyyy");
Date da = (Date)formatter.parse(strDate);
System.out.println("==Date is ==" + da);
String strDateTime = formatter.format(da);
System.out.println("==String date is : " + strDateTime);
}