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
- regex
- Spring Batch
- current_date
- Effective Java 3/e
- log_bin
- Express
- Effective Java
- java
- git
- Regular expression
- nodejs
- 정규표현식
- mysql 5.5
- upgrade
- MySQL
- Webpack
- spring cloud
- npm
- log4j2
- 퀵소트
- update
- REACTJS
- expire_logs_days
- Chunk
- Node
- eslint
- REACT
- migration
- spring
- JavaScript
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 |