aspose file tools
The moose likes Beginning Java and the fly likes Extract date parts from time stamp Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Extract date parts from time stamp " Watch "Extract date parts from time stamp " New topic
Author

Extract date parts from time stamp

Meir Yan
Ranch Hand

Joined: Apr 27, 2006
Posts: 597
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

Joined: Dec 11, 2004
Posts: 13410

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.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Extract date parts from time stamp
 
Similar Threads
Extract date parts from time stamp
timestamp with microseconds
Timestamp problem
How to create a date object which contain current date
Timestamp in GMT and the difference