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
번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|
11 | [ChatGPT] JDBC API에서 java.sql과 javax.sql 패키지의 차이점 | 황제낙엽 | 2025.01.31 | 131 |
10 | ResultSet 을 순회하기 전에 사이즈 구하기 | 황제낙엽 | 2021.01.14 | 290 |
9 | ResultSet 의 사이즈로 조회 결과가 있는지 확인 | 황제낙엽 | 2021.01.14 | 337 |
8 | SQLite JDBC Driver | 황제낙엽 | 2020.02.25 | 3625 |
7 |
Microsoft SQL Server JDBC 드라이버 2.0
![]() | 황제낙엽 | 2019.05.22 | 470 |
6 |
간단한 DBConnection 프로그램 (JDBC)
![]() | 황제낙엽 | 2008.05.15 | 456 |
5 | [Tip] 톰캣 JNDI DB POOL 설정하기 | 황제낙엽 | 2007.05.11 | 486 |
4 |
JDBC 테스트 페이지
![]() | 황제낙엽 | 2007.02.22 | 9263 |
3 | [JDBC] URL 사용법 모음 | 황제낙엽 | 2007.02.21 | 1496 |
» | JDBC Date 포맷 변환 | 황제낙엽 | 2003.11.08 | 938 |
1 | Connection 리소스 관리시 주의해야 할 점 | 황제낙엽 | 2003.09.06 | 429 |