250x250
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 | 31 |
Tags
- Effective Java 3/e
- Spring Batch
- REACTJS
- spring cloud
- Effective Java
- Chunk
- log4j2
- current_date
- npm
- regex
- migration
- JavaScript
- expire_logs_days
- spring
- 퀵소트
- git
- 정규표현식
- try catch
- Express
- update
- java
- upgrade
- REACT
- Node
- eslint
- Regular expression
- log_bin
- mysql 5.5
- nodejs
- MySQL
Archives
- Today
- Total
내 세상
[Java] 현재 시간을 yyyyMMddHHmmss String으로 추출하는 코드 본문
728x90
반응형
https://hashcode.co.kr/code_runners?language=java
import java.util.Date;
import java.util.Locale;
import java.text.SimpleDateFormat;
class Test{
public static void main(String[] args)
{
Date today = new Date();
Locale currentLocale = new Locale("KOREAN", "KOREA");
String pattern = "yyyyMMddHHmmss"; //hhmmss로 시간,분,초만 뽑기도 가능
SimpleDateFormat formatter = new SimpleDateFormat(pattern, currentLocale);
System.out.println(formatter.format(today));
}
}
728x90
반응형
'Language > Java' 카테고리의 다른 글
[Java] Java Stream (0) | 2022.04.06 |
---|---|
[Java] 정규 표현식 (Regex) Pattern, Matcher 사용 (0) | 2022.01.05 |
[Java] Log4j 1.x to Log4j 2 Migration - Configuring Log4j 2 (0) | 2021.12.14 |
[Java] Log4j 1.x to Log4j 2 Migration - Converting to the Log4j 2 API (0) | 2021.12.14 |
[Java] Effective Java 3/e - Item 12) toString을 항상 재정의하라 (0) | 2021.12.06 |