This discussion is archived
4 Replies Latest reply: Jan 22, 2008 12:15 PM by 807603 RSS

Comparing dates and file names

807603 Newbie
Currently Being Moderated
I have a problem about comparing a file name substring with the current date such like this,

XXX01012008.txt -> File name
01012008 -> Current date

Calendar today = Calendar.getInstance();

BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
            String file = stdin.readLine();

if(file.substring(4,10).equals(today))

   //then read it 
else 
  //create a new file with the current date
That's the deal

Thanks for reading