2011년 7월 11일 월요일

책 정보 사이트

http://www.oneofworld.com

아,, 드뎌 올리는구나.

아직 정리할건 하도 많아 가늠도 안되지만 그래도 이제는 공개한다는거 자체가 좋구나.


2011년 6월 30일 목요일

[JavaScript] Date to String

function convertDateToYear(date){
    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);
}