I have a program that will run on the 1st of the month. Then it will create a report of documents from last month.
For example, if it runs today (2018-04-09T11:35:58), it will go back and get documents only for the month of March from March 1st until March 31.
Currently the program is looking in a xml file for
<LastRunDateTime>2018-04-09T11:35:58</LastRunDateTime>
to get documents report.
I do not want to have this hard coded date in config file.
Every time my program runs, it is updating the config file's LastRunDateTime to currentDateTime.
Here is how I am doing this updating
UpdateConfigFile with current date
objXmlTaskConfigDoc.DocumentElement.SelectSingleNode("LastRunDateTime").InnerText = dtmCurrentDateTime.ToString("yyyy-MM-ddTHH:mm:ss")
How can I do this without using hard coded date in config file? I want to skip the config file and calculate datetime inside my vb.net code. That is last months report regardless of the date the program runs. If it runs on April 15th, it should still get report of the month of March from March first until March 31st.
What I have tried:
The config file has this element which is updated by the following line of code
<LastRunDateTime>2018-04-09T11:35:58</LastRunDateTime>
objXmlTaskConfigDoc.DocumentElement.SelectSingleNode("LastRunDateTime").InnerText = dtmCurrentDateTime.ToString("yyyy-MM-ddTHH:mm:ss")