hanker

JAVA - Timestamp to String (13자리) 본문

JAVA

JAVA - Timestamp to String (13자리)

hanker 2024. 9. 3. 10:13
반응형
    public static void main(String[] args) throws Exception {

        Timestamp ts = new Timestamp(System.currentTimeMillis());
        System.out.println("Timestamp 출력: " + ts);

        System.out.println("Timestamp to String 출력: " + getTimeStamp(ts));
    }

    /**
     *  parameters (Timestamp) return (String 13)
     */
    public static String getTimeStamp(Timestamp item) {
        if(item == null) {
            return null;
        }

        return String.valueOf(item.getTime());
    }

 

 

반응형