Using Java enter string get variables day month year.
Posted on 2009-02-13
I have completed almost all of my assignment but the last part has me stuck. I need to be able to input a Date string and then convert it to a day month and year.
For example. 02121973
int day = 02
int month = 12
int year = 1973
I know how to parse the string to an integer but not break it up. I need to do it this way because in my class I need to have a private variable birthDate and two methods setBirthDate() and getBirthDate(). I also have a seperate Date class that I have to use to print the format mm/dd/yyyy from. I did not include code because I think I am close on this and if I could get the String broken down I think I will be good. Any help would be great. Thanks