aspose file tools*
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
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