2011년 7월 11일 월요일
2011년 6월 30일 목요일
[JavaScript] Date to String
function convertDateToYear(date){
return date.getFullYear();
}
return date.getFullYear();
}
function convertDateToMonth(date){
return date.getMonth() + 1;
}
function convertDateToDay(date){
return date.getDate();
}
[Java] Date to String
public static String convertDateToString(Date date) {
if(date == null) return null;
SimpleDateFormat formatter = new SimpleDateFormat("yyyy년 M월 d일, h시 m분 s초");
return formatter.format(date);
}
public static String convertDateToYear(Date date) {
if(date == null) return null;
SimpleDateFormat formatter = new SimpleDateFormat("yyyy");
return formatter.format(date);
}
public static String convertDateToMonth(Date date) {
if(date == null) return null;
SimpleDateFormat formatter = new SimpleDateFormat("MM");
return formatter.format(date);
}
public static String convertDateToDay(Date date) {
if(date == null) return null;
SimpleDateFormat formatter = new SimpleDateFormat("dd");
return formatter.format(date);
}
if(date == null) return null;
SimpleDateFormat formatter = new SimpleDateFormat("yyyy년 M월 d일, h시 m분 s초");
return formatter.format(date);
}
public static String convertDateToYear(Date date) {
if(date == null) return null;
SimpleDateFormat formatter = new SimpleDateFormat("yyyy");
return formatter.format(date);
}
public static String convertDateToMonth(Date date) {
if(date == null) return null;
SimpleDateFormat formatter = new SimpleDateFormat("MM");
return formatter.format(date);
}
public static String convertDateToDay(Date date) {
if(date == null) return null;
SimpleDateFormat formatter = new SimpleDateFormat("dd");
return formatter.format(date);
}
피드 구독하기:
글 (Atom)