Note that there are some explanatory texts on larger screens.

plurals
  1. POIssue is converting seconds to date/time in Java
    primarykey
    data
    text
    <p>I want to convert the seconds from DEC 31ST 1969 7 PM to date/time in the following java code.</p> <pre><code>package sampProp; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import java.util.StringTokenizer; import java.util.TimeZone; public class sample { public static void main(String args[]) { //Here 1373605580 is the number os secs from DEC 31ST 1969 7 PM long millisecs = (long)(1373605580) *1000; DateFormat df = new SimpleDateFormat("MM/dd/yyyy_HH:mm:ss a"); df.setTimeZone(TimeZone.getTimeZone("EST")); Date d1 = new Date(millisecs); String formattedDate = df.format(d1); System.out.println("Formatted date is "+formattedDate); } } </code></pre> <p>I'm running the code on AIX server.</p> <p>My development server gives the value <code>07/12/2013_00:06:20</code> which is the correct one but my production server gives <code>07/12/2013_01:06:20</code> which is not correct.</p> <p>How is this possible. And how can I correct this. </p> <p>My Development server's java-version output is: </p> <pre><code>java version "1.5.0" Java(TM) 2 Runtime Environment, Standard Edition (build pap64dev-20071008 (SR6)) IBM J9 VM (build 2.3, J2RE 1.5.0 IBM J9 2.3 AIX ppc64-64 j9vmap6423-20071007 (JIT enabled) J9VM - 20071004_14218_BHdSMr JIT - 20070820_1846ifx1_r8 GC - 200708_10) JCL - 20071008 </code></pre> <p>And my production server's java-version output is:</p> <pre><code>java version "1.5.0" Java(TM) 2 Runtime Environment, Standard Edition (build pap64dev-20080315 (SR7)) IBM J9 VM (build 2.3, J2RE 1.5.0 IBM J9 2.3 AIX ppc64-64 j9vmap6423-20080315 (JIT enabled) J9VM - 20080314_17962_BHdSMr JIT - 20080130_0718ifx2_r8 GC - 200802_08) JCL - 20080314 </code></pre>
    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.
 

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