java.util.Date get milliseconds -


i have done following:

string standardrange = "00:01:01"; simpledateformat rangeformatter = new simpledateformat("hh:mm:ss"); date range = rangeformatter.parse(standardrange); 

now:

range.gettime(); 

.. output of -3539000 , not 61,000

i'm not sure i'm doing wrong; when debugging, cdate exists, attribute contains fraction, contains value 61,000, want.

the reason you're seeing date you're creating in past of date epoch, not 1m1s after it:

string standartrange = "00:01:01"; simpledateformat rangeformatter = new simpledateformat("hh:mm:ss"); date range = rangeformatter.parse(standartrange);  system.out.println(new date(0l)); system.out.println(new date(0l).gettime()); system.out.println(range); system.out.println(range.gettime()); 

and output;

thu jan 01 01:00:00 gmt 1970 0 thu jan 01 00:01:01 gmt 1970 -3539000 

the epoch date incorrect here - should 00:00:00, due historical bug bst/gmt changed dates , timezone cant keep track. seems sun/oracle consider historical "inaccuracy".

check out bug report - describes problem more fully.

from language (german) may not directly due bst issue, related.


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -