sitelink1 | |
---|---|
sitelink2 | |
sitelink3 | |
sitelink4 | |
sitelink5 | |
sitelink6 |
Example>>
/* Source **************************************************************************/
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd a HH:mm:ss");
String result = sdf.format(new java.util.Date(System.currentTimeMillis()));
System.out.println(result);
/*********************************************************************************/
/* SQL Query **************************************************************************/
select input_time from db_monitor where to_char(input_time , 'RRRR-MM-DD HH24:MI:SS') < '2003-11-08 17:52:35';
/*********************************************************************************/
/* JAVA Code **************************************************************************/
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String input_time = sdf.format(new java.util.Date(System.currentTimeMillis()));
String QUERY = INSERT INTO 테이블이름 values ( to_date( '"+ input_time +"' , 'RRRR-MM-DD HH24:MI:SS' ) );
/*********************************************************************************/
<참고>
1. 자바서비스넷 이원영씨의 관련 게시글 -> 보기
2. java.sql.Date 클래스에 다음같은 메서드도 있다.
[ public static Date valueOf(String s)
-> Converts a string in JDBC date escape format to a Date value.
Parameters:
s - a String object representing a date in in the format "yyyy-mm-dd"
Returns:
a java.sql.Date object representing the given date
Throws:
IllegalArgumentException - if the date given is not in the JDBC date escape format (yyyy-mm-dd) ]
3. java.text.SimpleDateFormat 클래스는 java.text.DateFormat 클래스에서 상속받은 다음의 메서드도 있다.
[ public Date parse(String source) throws ParseExceptionParses
-> text from the beginning of the given string to produce a date. The method may not use the entire text of the given string.
See the parse(String, ParsePosition) method for more information on date parsing.
Parameters:
source - A String whose beginning should be parsed.
Returns:
A Date parsed from the string.
Throws:
ParseException - if the beginning of the specified string cannot be parsed. ]
/* Source **************************************************************************/
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd a HH:mm:ss");
String result = sdf.format(new java.util.Date(System.currentTimeMillis()));
System.out.println(result);
/*********************************************************************************/
/* SQL Query **************************************************************************/
select input_time from db_monitor where to_char(input_time , 'RRRR-MM-DD HH24:MI:SS') < '2003-11-08 17:52:35';
/*********************************************************************************/
/* JAVA Code **************************************************************************/
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String input_time = sdf.format(new java.util.Date(System.currentTimeMillis()));
String QUERY = INSERT INTO 테이블이름 values ( to_date( '"+ input_time +"' , 'RRRR-MM-DD HH24:MI:SS' ) );
/*********************************************************************************/
<참고>
1. 자바서비스넷 이원영씨의 관련 게시글 -> 보기
2. java.sql.Date 클래스에 다음같은 메서드도 있다.
[ public static Date valueOf(String s)
-> Converts a string in JDBC date escape format to a Date value.
Parameters:
s - a String object representing a date in in the format "yyyy-mm-dd"
Returns:
a java.sql.Date object representing the given date
Throws:
IllegalArgumentException - if the date given is not in the JDBC date escape format (yyyy-mm-dd) ]
3. java.text.SimpleDateFormat 클래스는 java.text.DateFormat 클래스에서 상속받은 다음의 메서드도 있다.
[ public Date parse(String source) throws ParseExceptionParses
-> text from the beginning of the given string to produce a date. The method may not use the entire text of the given string.
See the parse(String, ParsePosition) method for more information on date parsing.
Parameters:
source - A String whose beginning should be parsed.
Returns:
A Date parsed from the string.
Throws:
ParseException - if the beginning of the specified string cannot be parsed. ]
댓글 0
번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|
43 | JDF(Java Development Framework) 관련 | 황제낙엽 | 2004.02.11 | 505 |
» | JDBC Date 포맷 변환 | 황제낙엽 | 2003.11.08 | 938 |
41 | Connection 리소스 관리시 주의해야 할 점 | 황제낙엽 | 2003.09.06 | 429 |
40 | XSLTFilter ... (퍼옴) | 황제낙엽 | 2003.07.21 | 634 |
39 | (초보탈출 II) 내부클래스 | 황제낙엽 | 2003.05.20 | 505 |
38 | (초보탈출 I) 패키지 | 황제낙엽 | 2003.05.20 | 544 |
37 | 열네번째날 (화상 채팅 프로그램 프로젝트) | 황제낙엽 | 2003.04.21 | 945 |
36 | 열세번째날 - WEB APPLICATION | 황제낙엽 | 2003.04.15 | 824 |
35 | 열두번째날 - I/O | 황제낙엽 | 2003.04.15 | 285 |
34 | 열하나째날 - 스레드 | 황제낙엽 | 2003.04.15 | 330 |
33 | 열번째날 - 애플릿과 그래픽 | 황제낙엽 | 2003.04.15 | 617 |
32 | 아홉째날 - SWING | 황제낙엽 | 2003.04.15 | 542 |
31 | 여덟째날 - 예외처리 | 황제낙엽 | 2003.04.14 | 527 |
30 | 일곱째날 - EVENT | 황제낙엽 | 2003.04.14 | 245 |
29 | 여섯째날 - AWT | 황제낙엽 | 2003.04.14 | 628 |
28 | 다섯째날 - Collection, String, StringBuffer | 황제낙엽 | 2003.04.14 | 562 |
27 | 넷째날 - 추상클래스, 내부클래스, Interface, Static영역 | 황제낙엽 | 2003.04.14 | 566 |
26 | 셋째날 - 패키지, 상속, 접근제어 | 황제낙엽 | 2003.04.14 | 509 |
25 | 둘째날 - 클래스, 메서드, 연산자 | 황제낙엽 | 2003.04.14 | 482 |
24 | 첫째날 - 자바의 특징과 DATA TYPE | 황제낙엽 | 2003.04.14 | 457 |