Search code examples
javauti

Get GMT Time in Milliseconds using JAVA


Possible Duplicate:
Get GMT Time in Java

I have taken the reference of the below 2 link :

link1 link2

But I want the GMT date in milliseconds.

Thanks In Advance.


Solution

  • Use Calendar#getTimeInMillis:

    Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
    long time = cal.getTimeInMillis();