0

I've done lots of epoch time to string date conversions

but I never remember if I use some date time object or SimpleDateFormat or JodaTime or Calendar method, and they all have their own legends for formatting. On top of that, I'm not sure if I need to divide my epoch object by 1000 or something to make the timestamp conversion work correctly, it is very... time... consuming

so how would I convert an epoch timestamp to this format "March 16, 8:01 EDT" , where 8:01 is 24 hour time, and EDT is a timezone abbreviation

CQM
  • 42,592
  • 75
  • 224
  • 366
  • possible duplicate of [java convert milliseconds to time format](http://stackoverflow.com/questions/4142313/java-convert-milliseconds-to-time-format) – Basil Bourque Sep 09 '14 at 00:24

1 Answers1

1

I'm using JodaTime for this:

DateTimeFormatter dtf = DateTimeFormat.forPattern("MMM dd, HH:mm z");
dtf = dtf.withZone(DateTimeZone.UTC);
System.out.println(dtf.print(System.currentTimeMillis()));
Krayo
  • 2,492
  • 4
  • 27
  • 45