Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Date format conversion  RSS feed

 
akhil achuthan
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i want to find when a particular file was last modified. So i use lastModified() function. bit it returns milliseconds from epoch as a long value. How do i get it in actual dd-mm-yyyy format
 
KasiMurugan Ramasamy
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

1.First create a SimpleDateFormat(specify your dateformat as String) Object.

2. Then create a java.util.Date from the time( new Date(long))

then simpleDateFormatObject(created on the 1st stemp).format(urDate, which is created on the 2nd Stemp).
 
Nils Alexander
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this:


 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!