-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
  • 497
  • 1
  • 12
  • 28

1 Answers1

6
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(timestamp);
int year = cal.get(Calendar.YEAR);
sidgate
  • 13,104
  • 9
  • 60
  • 107