I have been looking at the API to see if I can change a string (representation of a date) to a date, so that I can manipulate the date, then set it back to a String.
ok, I know I can confuse.
I have a gui, that has todays date in a JTextArea, I have a button that opens up a date picking calendar so that I can pick a date, and send that date to the JTextArea, so that the date is updated. All is working really well here.
but I have buttons that I want to move the date up or down by one day at a time. Currently looking like Friday 16 March 2007
so the JTextArea has a String to show that date.
I seen in SimpleDateFormat class there is a method called parse, this takes a String (the one I show currently) and ParsePosition as arguments.
I am really confused with the ParsePosition, I have read through this part of the API and I am still stumped.
If the string that you are trying to parse contains the string representation of the date, and nothing else, you don't need to use the parse position. Just call the parse() method that takes the single string parameter.
As long as you define the pattern to match the date format of your string, it should work fine.