Created
October 29, 2013 05:20
-
-
Save yujuwon/7209501 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 현재 날짜 가져오기 | |
| 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