I have a String
which is formatted like so: "dd-MM-yyyy"
. I am trying to get the dd
part of the string saved into a integer day
variable. I want to do the same for the MM
and yyyy
parts of the String
. I can imagine parsing the String
using a for loop to separate the String
whenever the "/" char
is at the current index in the for
loop.
How do I split the String
containing the date into day, month and year respectively, into integer variables for me to operate on? Perhaps transferring this String
to a Date
object would make it easier due to a member method or field that handles this (just a thought).