简体   繁体   中英

Convert date to to_timestamp OracleDB

I'm using oracleDB to query for results in a time range. My date objects have a toString: Thu May 01 00:00:00 PDT 2013

How would I convert this date to to_timestamp?

I can do to_timestamp('dd-mm-yyyy hh24:mi:ss') but then I have to put the date into a string and then parse that string into another string then pass it into the query

I did n't know exactly it will works or not see

java.text.DateFormat outputFormat =new java.text.SimpleDateFormat("dd-MM-yyyy HH:mm:ss");
java.text.DateFormat outputFormat1 =new java.text.SimpleDateFormat("EEE MMM dd HH:mm:ss 'PDT' yyyy");
System.out.println(outputFormat.format(outputFormat1.parse("Thu May 01 00:00:00 PDT 2013")));//01-05-2013 00:00:00

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM