In your stringDate there should be your user input that you want to process.Ryan Bishop wrote:Would it be something like this? (I don't know what to put as the stringDate but figured I'd at least ask.)
I tried the date you gave and see it doesn't work but I'm too fried at this point to realize what to do.
Ryan Bishop wrote:I tried the date you gave and see it doesn't work but (...)
Ryan Bishop wrote:to calculate the day since if I use "userInput" anywhere it gives me an error.
I wrote:1. You expect your date to be passed in specific format, right? So use DateFormat class. Your format is simple so SimpleDateFormat will suffice.
2. You don't want it to be lenient. No things like February 30th allowed. So setLenient to false.
3. Then, you can easily parse the String giving you a Date object.
4. What can you do with such object? Well, you might create a Calendar instance
5. and setTime to that date.
6. Then, you can get the DAY_OF_YEAR. Problem solved!
Ryan Bishop wrote:My understanding of that is I'm formatting the date incorrectly but I am not seeing how.