Note that there are some explanatory texts on larger screens.

plurals
  1. POProblems with Date manipulation
    primarykey
    data
    text
    <p>I am getting 2 timestamps from the Oracle database start and end dates. They come in this format<code>yyyy-MM-dd HH:mm:ss.SSS</code></p> <p>Now I am getting another timestamp for comparison from a text file. It's in String format. Below is the code that I have written to extract the required info.</p> <pre><code> DateFormat f = new SimpleDateFormat("EEE MMM dd HH:mm:ss zz yyyy"); Date date = f.parse("Tue Aug 23 20:00:03 PDT 2011"); System.out.println("---date----" + f.format(date)); String originalDate = f.format(date); System.out.println("---originalDate----" + originalDate); DateFormat f2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); String dateParse = f2.format(date); System.out.println("---dateParse----"+dateParse); </code></pre> <p>The output that I am getting is a little strange and is very inconsistent. Below is sample ---date----Tue Aug 23 20:00:03 PDT 2011 ---originalDate----Tue Aug 23 20:00:03 PDT 2011 ---dateParse----2011-08-24 08:30:03.000</p> <p>In the above output I am interested in the ----dateparse--- value as I need this for comparison. Now if you see the values are varying in the ideal case both should be same value.</p> <p>The issue here is if the output varies with the timezone then how am I supposed to do comparison in the code from the data that is fetched from the database? </p> <p>I just need to see if --dateparse-- lies between the date ranges that I get from db. Will this code work properly independent of the timezone or there is some issue here. If the date is varying then my comparison can go wrong or is it the correct way with the above 2 outputs.</p> <p>Can you please let me know how I can resolve this issue.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload