Get timestamp and convert it to string

java

Solution

The shortest is

String secs = "" + System.currentTimeMillis() / 1000;

If you want to retain milli-seconds you can use

String secs = String.format("%.3f",  System.currentTimeMillis() / 1000.0);

produces a String like

1342604140.503

Problem

I'm using this to get current timestamp in seconds and add it to a string `Double.toString((System.currentTimeMillis()/1000))` However instead of decimal notation I get "1.23213E9". How do I switch to the decimal notation ?

Original source