Skip to content

Instantly share code, notes, and snippets.

@yujuwon
Created October 29, 2013 05:20
Show Gist options
  • Select an option

  • Save yujuwon/7209501 to your computer and use it in GitHub Desktop.

Select an option

Save yujuwon/7209501 to your computer and use it in GitHub Desktop.
// 현재 날짜 가져오기
function getCurrentDate(){
var week = new Array('일', '월', '화', '수', '목', '금', '토');
var today = new Date();
var year = today.getFullYear();
var month = today.getMonth() + 1;
var day = today.getDate();
var dayName = week[today.getDay()];
console.log("현재 날짜는 %d-%d-%d %s요일 입니다.", year, month, day, dayName);
}
// 어제 날짜 가져오기
function getYesterDay(){
var today = new Date();
var yesterday = new Date(today.valueOf() - (24*60*60*1000));
var year = yesterday.getFullYear();
var month = yesterday.getMonth() + 1;
var day = yesterday.getDate();
}
// 내일 날짜 가져오기
function getTomorrow(){
var today = new Date();
var tomorrow = new Date(today.valueOf() + (24*60*60*1000));
var year = tomorrow.getFullYear();
var month = tomorrow.getMonth() + 1;
var day = tomorrow.getDate();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment