레이블이 날짜인 게시물을 표시합니다. 모든 게시물 표시
레이블이 날짜인 게시물을 표시합니다. 모든 게시물 표시

2013년 4월 24일 수요일

[ Javascript ] 날짜 취득


날짜 취득 샘플

<SCRIPT language="JavaScript">
  DD = new Date();
  Year = DD.getYear();
  Month = DD.getMonth() + 1;
  Day = DD.getDate();
  document.write(Year,"년",Month,"월",Day,"일");
</SCRIPT>

2013년 4월 23일 화요일

[ Jsp ][ Javascript ][ 날짜 ] 날짜 비교

단순 날짜 비교


var dt1 = new Date(2013, 8 - 1, 10);
var dt2 = new Date(2013, 7 - 1, 31);
if(dt1.getTime() > dt2.getTime()) {
    document.write("dt1<br />\r\n");
} else {
    document.write("dt2<br />\r\n");
}

[ Jsp ][ Javascript ][ 날짜 ] 특정 년 월 말일 구하기


특정 년 월의 말일 날짜 구하기


function getMonthEndDate(year, month) {
    var dt = new Date(year, month, 0);
    return dt.getDate();
}

[ Jsp ][ Javascript ][ 날짜 ] 윤년 체크

윤년 체크후 true false 반환


function checkLeapyear(year) {
    return (year % 4 == 0 && year % 100 != 0) || year % 400 == 0;
}

[ Jsp ][ Javascript ][ 날짜 ] 오늘 날짜 표시

오늘 날짜 단순 표시 하기

var date = new Date();

document.write(date.getFullYear()  + "-" + (date.getMonth() + 1) + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds() + "<br />\r\n");

2013년 4월 16일 화요일

[ Java ] Calender 날짜 비교


  
중략
날짜 비교 before , after , equals

Calendar c1 = Calendar.getInstance();
Calendar c2 = Calendar.getInstance();
c1.set(2013, 4, 1);
c2.set(2013, 4, 1);

if (c1.before(c2))
{
 System.out.print(" is before ");
}
if (c1.after(c2))
{
 System.out.print(" is after ");
}
if (c1.equals(c2))
{
 System.out.print("same ");
}

2013년 3월 4일 월요일

[ Jsp ][ Java ] 이번 달 마지막 날짜 오늘 날짜 비교


오늘이 이번 달 마지막 날이면 //해야할 처리

GregorianCalendar today = new GregorianCalendar ( );
int maxday = today.getActualMaximum ( ( today.DAY_OF_MONTH ) );
drLog.info(maxday);

int todayDay = today.get(today.DAY_OF_MONTH);
drLog.info(todayDay);

if(maxday == todayDay){
//해야할 처리
}