Notice
Recent Posts
Recent Comments
Link
250x250
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 정규표현식
- Effective Java
- log_bin
- eslint
- nodejs
- Express
- Spring Batch
- upgrade
- MySQL
- Chunk
- Node
- log4j2
- spring
- java
- git
- REACT
- REACTJS
- Regular expression
- expire_logs_days
- regex
- Webpack
- update
- spring cloud
- migration
- npm
- mysql 5.5
- JavaScript
- 퀵소트
- Effective Java 3/e
- current_date
Archives
- Today
- Total
내 세상
[Java] 현재 시간을 yyyyMMddHHmmss String으로 추출하는 코드 본문
728x90
https://hashcode.co.kr/code_runners?language=java
코드 실행기 | Hashcode
로그인하시겠습니까?
hashcode.co.kr
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 |