0

I need to convert a UNIX epoch time to day and time something like:

e.g. 1309778593 to Monday, 11:23:12

Any help?

sarnold
  • 99,632
  • 21
  • 173
  • 228

2 Answers2

1

Pull the date components from this:

new Date(1309778593)
Marcelo Cantos
  • 174,413
  • 38
  • 319
  • 360
1

You can do this with help of following code-

String epochTime = "1309778593";
Date convertedDate = new Date(Long.parseLong(epochTime) * 1000);
System.out.println(convertedDate);

This will print-

Mon Jul 04 13:23:13 CEST 2011

I think this will help!

beshkenadze
  • 646
  • 5
  • 12
Sapan Diwakar
  • 9,858
  • 5
  • 31
  • 43