if it's start of the month...do this? : <p>I want my code to empty a specific text file, when it is the beginning of each month. I have this code but it doesn't seem to work, do I have something wrong with the syntax maybe?</p>

<pre><code>public void monthlyCleanse(File f){

    LocalDate localDate = LocalDate.now();

    String d = DateTimeFormatter.ofPattern("dd").format(localDate);

    System.out.println(d);

    if(d.equals("01")){


        "filename.txt".replace(toString().valueOf(f), "");
    }
}
</code></pre>

<p>As you can see I am changing the format to only show the day of the month, then I am checking if that day equals "01" then do something...which is to empty a text file. </p>

<p>Then i am calling it here...</p>

<pre><code>    monthlyCleanse(new File("filename.txt"));
</code></pre>

<p>How can i make sure that this file is emptied?</p>
