프로그래밍
리눅스에서 날짜 다루기
어린왕자악꿍
2013. 4. 23. 09:14
리눅스에서 현재 날짜를 알기 위해 사용하는 명령어는 date이다.
2013. 04. 23. (화) 09:04:26 KST
오늘 날짜의 포멧을 변경하려면 아래와 같이 한다.
shell> date +%Y-%m-%d
2013-04-23
어제와 내일의 날짜를 구하려면,
shell> date -d "yesterday"
shell> date -d "tomorrow"
지난 주, 다음 주의 날짜는,
shell> date -d "last monday"
shell> date -d "next monday"
마지막으로 몇 일전, 몇 달전, 몇 년후의 날짜는,
shell> date -d "+10 days"
shell> date -d "-10 month"
shell> date -d "-10 year"
shell> date -d "-10 week"