converting String ex. 08/06/2006 to an integer.

I have this string for example 08/06/2005how do i convert it to an integer?
[89 byte] By [Fez_0a] at [2007-11-27 0:36:36]
# 1
well, you could use a SimpleDateFormat to create an instance of Date from the string and then call the getTime method on that Date instance. However, that gives you a long rather then an int. Not sure what your requirement is for getting it as an int...
cjmosea at 2007-7-11 22:46:05 > top of Java-index,Java Essentials,New To Java...
# 2
> I have this string for example 08/06/2005> > how do i convert it to an integer?What do you mean? What are your conversion rules--what's the relationship between the input string and the output int?What int would that be?
jverda at 2007-7-11 22:46:06 > top of Java-index,Java Essentials,New To Java...
# 3
well the int would be 08062006i have to get rid of the slashes, i dunno how
Fez_0a at 2007-7-11 22:46:06 > top of Java-index,Java Essentials,New To Java...
# 4
Do you mean 08062005 ?And if it is a number, it would be no leading zero, right ?Otherwise, you just need a string without the slashes ?
rym82a at 2007-7-11 22:46:06 > top of Java-index,Java Essentials,New To Java...
# 5
> well the int would be 08062006> > i have to get rid of the slashes, i dunno howYou mean 8062006.
jverda at 2007-7-11 22:46:06 > top of Java-index,Java Essentials,New To Java...
# 6
yess
Fez_0a at 2007-7-11 22:46:06 > top of Java-index,Java Essentials,New To Java...
# 7
> Do you mean 08062005 ?> > And if it is a number, it would be no leading zero,> right ?> Otherwise, you just need a string without the slashes> ?Right. Numbers don't have leading zeroes.
jverda at 2007-7-11 22:46:06 > top of Java-index,Java Essentials,New To Java...
# 8
so how do i get rid of the slashes?
Fez_0a at 2007-7-11 22:46:06 > top of Java-index,Java Essentials,New To Java...
# 9
You can use String's replaceAll method to get rid of the slashes and leading zero, and then Integer.parseInt to convert the result to an int.But why are you doing this? What are you trying to accomplish?
jverda at 2007-7-11 22:46:06 > top of Java-index,Java Essentials,New To Java...
# 10
Let me make a guess, you don't want to change it to an integer but would like to change the data representation format to ddMMyyyy ?
rym82a at 2007-7-11 22:46:06 > top of Java-index,Java Essentials,New To Java...
# 11
> Let me make a guess, you don't want to change it to> an integer but would like to change the data> representation format to ddMMyyyy ?He's been sending some conflicting messages. It's not clear whether he wants the int 8062006 or the String "08062006".
jverda at 2007-7-11 22:46:06 > top of Java-index,Java Essentials,New To Java...