-1

I am calculating timestamp from system time as

System.currentTimeMillis()

in java.

Later, i want to calculate year , moth and date from this time stamp. is there any way to do so?

nand
  • 517
  • 2
  • 13
  • 29

1 Answers1

6
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(timestamp);
int year = cal.get(Calendar.YEAR);
sidgate
  • 14,650
  • 11
  • 68
  • 119