반응형
SimpleDateFormat 은 자유자재로 설정하시면됩니다
현재 저같은경우 20191008 000000
만약 SimpleDateFormat("yyyy-MM-dd" HH:mm:ss"); 설정할 경우
2019-10-08 00:00:00 으로 나오게 됩니다
참고하시면 되요!
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
/***********************************************************************
* 현재시간 가져오기
*
* @return
* *********************************************************************/
public String fn_time()
{
SimpleDateFormat Format = new SimpleDateFormat("yyyyMMdd HHmmss");
Date time = new Date();
String timedata = Format.format(time).toString();
return timedata;
}
/***********************************************************
* 어제시간 가져오기
*
* @return
*********************************************************/
public String fn_Yesterday() {
SimpleDateFormat Format = new SimpleDateFormat("yyyyMMdd HH");
Calendar cal = Calendar.getInstance();
String timedate = Format.format(cal.getTime());
return timedate;
}
/***********************************************************************
*
*
* @return
*********************************************************************/
public String fn_time() {
SimpleDateFormat Format = new SimpleDateFormat("yyyyMMdd HHmmss");
Date time = new Date();
Calendar cal = Calendar.getInstance();
cal.setTime(time);
String timedata = Format.format(cal.getTime()).toString();
return timedata;
}
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripter
|
반응형
'JAVA' 카테고리의 다른 글
[JMS]Activemq 메시지 생성자(Producer) 기초 소스 (0) | 2020.07.27 |
---|---|
자바 but this resultset is forward_only 에러 해결방법 (0) | 2020.01.03 |
자바에서 상속이란 무엇일까? (0) | 2019.07.17 |
싱글톤 디자인 패턴 (0) | 2019.07.14 |
자바 소켓을 이용한 클라이언트 (5) | 2019.07.09 |