store a date from string

i have a string which stores "26/05/06" ...how can i store it into a Date and retrieve the year to get the output "2006"thanks alot.
[153 byte] By [echizena] at [2007-10-3 6:45:13]
# 1

java.text.SimpleDateFormat.parse to turn that string into a date. SimpleDateFormat (a different instance, with a different format) to get a String from the date, or java.util.GregorianCalendar to get the int 2006.

Of couse, if you just want to turn the "06" portion of that String into the String "2006," you could use regex or simple String manipulation methods--substring, indexOf, concatenation, etc.

[url=http://www.javaworld.com/jw-12-2000/jw-1229-dates.html]Calculating Java dates: Take the time to learn how to create and use dates[/url]

[url=http://www.javaalmanac.com/egs/java.text/FormatDate.html]Formatting a Date Using a Custom Format[/url]

[url=http://www.javaalmanac.com/egs/java.text/ParseDate.html]Parsing a Date Using a Custom Format[/url]

jverda at 2007-7-15 1:34:58 > top of Java-index,Other Topics,Algorithms...