Search

Thứ Ba, 21 tháng 1, 2014

Convert a String to Date (Chuyển đổi một string sang ngày)

import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {

  public static void main(String[] argsthrows Exception {

    SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");

    Date theDate = dateFormat.parse("01/01/2009");
    System.out.println(dateFormat.format(theDate));

  }
}
//01/01/2009

0 nhận xét:

Đăng nhận xét

 
Le Van Chat