Click here to Skip to main content
15,889,462 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
HTML
<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
VB
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
XML
<LastRunDateTime>2018-04-09T11:35:58</LastRunDateTime>

VB
'UpdateConfigFile with current date
objXmlTaskConfigDoc.DocumentElement.SelectSingleNode("LastRunDateTime").InnerText = dtmCurrentDateTime.ToString("yyyy-MM-ddTHH:mm:ss")
Posted
Updated 9-Apr-18 8:09am
v3
Comments
Richard MacCutchan 9-Apr-18 12:56pm    
If you do not have the date in the config file then how do you decide which months data to process?
MadMyche 9-Apr-18 13:21pm    
You could always use an external DAT file for this
Member 11403304 9-Apr-18 13:34pm    
The report is based on customer request. So a customer can requested a report for the Month of March. So when my program run (it is not running yet but in the future), it will get data from the database using a sql query that I have but then it will only give a report in form of a spreadsheet (this is done) for dates e.g. March 1st - March 31st or September 1 - September 30 etc.

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900