I have time in milliseconds I need to convert it to RFC-822 format. Is there generic Java library that can I use? What is the best practice of doing it?
Example time in milliseconds: 1440612000000 Time in RFC-822: Wed, 02 Oct 2002 08:00:00 EST
Thanks in advance.
Use the SimpleDateFormat
SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz");
dateFormat.setTimeZone(TimeZone.getTimeZone("EST")); //To use the EST time zone as in your example
dateFormat.format(new Date(timeInMiliseconds));
As an example, with 1440612000000L outputs Wed, 26 Aug 2015 13:00:00 EST
.