• Post Reply Bookmark Topic Watch Topic
  • New Topic

Extract date parts from time stamp  RSS feed

 
Meir Yan
Ranch Hand
Posts: 599
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all
I have this line : String timestamp = String.valueOf(System.currentTimeMillis());
that gives me the current timestamp but now I need to extract from this timestamp
the day parts for example if my current timestamp is : 1154852914737 so it will be extracted to
nowYear:2006
nowMonth:8
nowDay:6
nowHour:11
nowMinute:30
nowSecond:2

thanks
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at the GregorianCalendar class:
http://java.sun.com/j2se/1.5.0/docs/api/java/util/GregorianCalendar.html


Since this is not a JSP specific question, moving to Java In General Beginner.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!