My code thus far:
String string = "Temp_2014_09_19_01_00_00.csv"
SimpleDateFormat format = new SimpleDateFormat("yyyy_MM_dd");
How can I check if the String contains a date? How can I retrieve this date? Any direction?
My code thus far:
String string = "Temp_2014_09_19_01_00_00.csv"
SimpleDateFormat format = new SimpleDateFormat("yyyy_MM_dd");
How can I check if the String contains a date? How can I retrieve this date? Any direction?
Copyright © 2021 Jogjafile Inc.
Here is a simple example of using regex to do what you want(You might want to research regex on your own):
The regex looks for
4digits_2digits_2digits
then it takes that match if it finds one and tries to convert it into a date. If it doesn't find a match thentempDate
will benull
. If you want to bring in thetimestamp
also you can do that too.