How to make Date format in Java, 자바 SimpleDateFormat 연월일/날짜 형식, time, 시분초, basic grammar
Sameple code
public void dateFormatTest() {
String dateFormat = "yyyyMMddHHmmss";
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(dateFormat);
String dateString = simpleDateFormat.format(new Date());
System.out.println(dateString);
}
You can use various dateFormat string to print different format using diff string format like examples below.
아래와 같이 dateFormat 문자를 바꿔서 다양하게 출력할 수 있다.
DataFormat Examples
dd-MM-yy 31-01-12
dd-MM-yyyy 31-01-2012
MM-dd-yyyy 01-31-2012
yyyy-MM-dd 2012-01-31
yyyy-MM-dd HH:mm:ss 2012-01-31 23:59:59
yyyy-MM-dd HH:mm:ss.SSS 2012-01-31 23:59:59.999
yyyy-MM-dd HH:mm:ss.SSSZ 2012-01-31 23:59:59.999+0100
EEEEE MMMMM yyyy HH:mm:ss.SSSZ Saturday November 2012 10:45:42.720+0100
Something else you might like...?
2019/01/18 - [Programming/Image Processing] - How to get image from usb camera using OpenCV in Java, 자바 openCV 이용하여 usb 카메라에서 이미지 저장, c++,영상처리,imageProcessing
2019/01/15 - [Programming/Java] - How to setup/install Oracle Java OpenJDK with OpenJFX and Eclipse IDE, whole development environment. 오라클 자바 OpenJDK, OpenJFX, Eclipse 전체 개발환경 설치 방법 / javafx, ojdk, ojfx, sceneBuilder
2019/01/15 - [Programming/Java] - How to use RxTx libraries, error/bug. RxTx Serial 통신 라이브러리 사용 방법,에러,버그 / Java
2018/12/28 - [Programming/Software Architecture] - Perfecting OO's Small Classes and Short Methods. 완벽한 객체지향의 작은 클래스와 짧은 메소드, Book:ThoughtWorks Anthology, Java,cpp,자바,oop,좋은코드,객체지향프로그래밍 - (#9, Tell, Don't Ask)
2018/12/26 - [Programming/Software Architecture] - Perfecting OO's Small Classes and Short Methods. 완벽한 객체지향의 작은 클래스와 짧은 메소드, Book:ThoughtWorks Anthology, Java,cpp,자바,oop,좋은코드,객체지향프로그래밍 (1)
2019/01/22 - [Algorithm/Leet Code] - LeetCode #220 ContainsDuplicate3. Algorithm,알고리즘,LeetCode,Codefights,CodeSignal,코드파이트,코드시그널,예제,문제해결능력,example,c++,java,재귀,recursive,datastructure,techinterview,coding,코딩인터뷰,기술면접
2019/01/21 - [Algorithm/Leet Code] - LeetCode #219 ContainsDuplicate2. Algorithm,알고리즘,LeetCode,Codefights,CodeSignal,코드파이트,코드시그널,예제,문제해결능력,example,c++,java,재귀,recursive,datastructure,techinterview,coding,코딩인터뷰,기술면접
2019/01/16 - [Algorithm/Leet Code] - LeetCode #217 ContainsDuplicate. Algorithm,알고리즘,LeetCode,Codefights,CodeSignal,코드파이트,코드시그널,예제,문제해결능력,example,c++,java,재귀,recursive,datastructure,techinterview,coding,코딩인터뷰,기술면접
2019/01/12 - [Algorithm/Code Fights (Code Signal)] - Aracade Intro #60 sudoku. Algorithm,알고리즘,Codefights,CodeSignal,코드파이트,코드시그널,예제,문제해결능력,example,c++,java,재귀,recursive
2019/01/12 - [Algorithm/Code Fights (Code Signal)] - Aracade Intro #59 spiralNumbers. Algorithm,알고리즘,Codefights,CodeSignal,코드파이트,코드시그널,예제,문제해결능력,example,c++,java,재귀,recursive
2019/01/08 - [Algorithm/Code Fights (Code Signal)] - Aracade Intro #58 messageFromBinaryCode. Algorithm,알고리즘,Codefights,CodeSignal,코드파이트,코드시그널,예제,문제해결능력,example,c++,java,재귀,recursive
2019/01/14 - [Programming/Java] - 자바 메모리 누수 체크/확인/고치는 방법, Memory leak check/fix in Java application, cleanCode/좋은코드/oop/객체지향
2019/01/17 - [Life/Health care] - Zinc 아연 usage/side effects/dosage/fatigue/supplement/antioxidant/효능/부작용/성인,소아 용법/건강/피로회복/영양제/항산화
2019/01/08 - [Life/Health care] - VitaminD 비타민디 usage/side effects/dosage/fatigue/supplement/antioxidant/효능/부작용/성인,소아 용법/건강/피로회복/영양제/항산화
2018/12/16 - [Life/Health care] - L-Arginine 아르기닌 usage/side effects/dosage 효능/부작용/성인,소아 용법(2)