This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes Converting Timestamp to date, month, year Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Converting Timestamp to date, month, year" Watch "Converting Timestamp to date, month, year" New topic
Author

Converting Timestamp to date, month, year

Joel Carklin
Greenhorn

Joined: Jun 15, 2001
Posts: 28
Hi,
Can someone please give me some pointers on the process of converting a java.sql.Timetamp into 3 int primitives, namely extracting date(1-31) month and year. I'm getting confused by all the different classes involved with date/time (ie Date, Timestamp, DateFormat, Calendar, etc)
Thanks
Joel
Chad McGowan
Ranch Hand

Joined: May 10, 2001
Posts: 265
Assuming you have the Timestamp object, use:

Chad
satish bora
Greenhorn

Joined: Jul 16, 2001
Posts: 18
You may like to add 1 to months, as Months start from 0 to 11.
(i.e .cal.get(Calendar.MONTH)+1 )
Cheers,
Satish


Sa
Joel Carklin
Greenhorn

Joined: Jun 15, 2001
Posts: 28
Thanks Satish and Chad
Works great, just the info I needed
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Converting Timestamp to date, month, year
 
Similar Threads
Passing Date from HTML Form to JSP/Action Handler
Convert date format to timestamp
java Timestamp
add 10 days to currentDate in java.util.Date or cast to Calendar?
Question on Gregorian Calendar