ezsnote

javascript date, month 날짜계산

IT/WEB

 

https://stackoverflow.com/questions/6040515/how-do-i-get-month-and-date-of-javascript-in-2-digit-format

 

("0" + this.getDate()).slice(-2)

for the date, and similar:

("0" + (this.getMonth() + 1)).slice(-2)

for the month.

 

근데 이것만으로는 안된다. 1월일때 -3 개월하면... -2라고 들어간다;

 

해서 

d.setMonth(d.getMonth()-3);

 

이런식으로 setMonth 를 해야한다. 

openjdk.. and remove oracle java in osx

IT/java

 

1. mac 에서 java 제거

https://www.java.com/ko/download/help/mac_uninstall_java.xml

 

sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin 

sudo rm -fr /Library/PreferencePanes/JavaControlPanel.prefPane 

sudo rm -fr ~/Library/Application\ Support/Oracle/Java

 

 

2. adoptopenjdk 설치 (1.8 버전을 예로 들면)

https://discourse.brew.sh/t/how-to-install-openjdk-with-brew/712/5

 

brew tap AdoptOpenJDK/openjdk

brew cask install adoptopenjdk8

 

설치 후에

 

java -version 으로 openjdk 설치유무 확인해봄 

stacktrace... 나를 호출한 메서드들을 찍어보자.

IT/java

 

    public static String informTrace() {

        String trace = "";
        try {
            StackTraceElement[] stackTrace = new Throwable().getStackTrace();
            for (StackTraceElement stackTraceElement : stackTrace) {
//            System.out.println("print::"+stackTraceElement.getClassName()+"/"+stackTraceElement.getMethodName()+"/"+stackTraceElement.getLineNumber());
                trace += stackTraceElement.getMethodName() + "<-";
            }
        } catch (Exception e) {
            LOGGER.warn("ignore traceUtil...");
        }

        return trace;
    }