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
  • 102,305
  • 22
  • 181
  • 238

2 Answers2

1

Pull the date components from this:

new Date(1309778593)
Marcelo Cantos
  • 181,030
  • 38
  • 327
  • 365
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
  • 10,480
  • 6
  • 33
  • 43