tl;dr
You have a number of whole seconds since 1970-01-01T00:00:00Z
rather than milliseconds.
Instant
.ofEpochSecond( 1_379_487_711L )
.atZone(
ZoneId.of( "Africa/Tunis" )
)
.toLocalDate()
.format(
DateTimeFormatter.ofPattern( "dd-MM-uuuu" )
)
See this code run at Ideone.com.
18-09-2013
Whole seconds versus Milliseconds
As stated above, you confused a count-of-seconds with a count-of-milliseconds.
Your confusion demonstrates why using a mere integer to represent a moment is a poor choice. Instead, use text, always in standard ISO 8601 format.
Using java.time
The other Answers may be correct but are outdated. The troublesome old date-time classes used there are now legacy, supplanted by the java.time classes. For Android, see the last bullets below.
The Instant
class represents a moment on the timeline in UTC with a resolution of nanoseconds (up to nine (9) digits of a decimal fraction).
Instant instant = Instant.ofEpochSecond( 1_379_487_711L ) ;
instant.toString(): 2013-09-18T07:01:51Z
Apply the time zone through which you want to view this moment.
ZoneId z = ZoneId.of( "America/Montreal" ) ;
ZonedDateTime zdt = instant.atZone( z ) ;
zdt.toString(): 2013-09-18T03:01:51-04:00[America/Montreal]
Generate a string representing this value in your desired format.
DateTimeFormatter f = DateTimeFormatter.ofPattern( "dd-MM-uuuu" ) ;
String output = zdt.format( f ) ;
18-09-2013
See this code run live at IdeOne.com.
About java.time
The java.time framework is built into Java 8 and later. These classes supplant the troublesome old legacy date-time classes such as java.util.Date
, Calendar
, & SimpleDateFormat
.
The Joda-Time project, now in maintenance mode, advises migration to the java.time classes.
To learn more, see the Oracle Tutorial. And search Stack Overflow for many examples and explanations. Specification is JSR 310.
Where to obtain the java.time classes?
The ThreeTen-Extra project extends java.time with additional classes. This project is a proving ground for possible future additions to java.time. You may find some useful classes here such as Interval
, YearWeek
, YearQuarter
, and more.