This was the answer that helped me, from the Stack Overflow, translated into English:
If you want to set the default value to DateTime.Now
, or allow it to be another value, you probably want code similar to this:
Dim magicDate = If(Not String.IsNullOrWhiteSpace(
ConfigurationManager.AppSettings("OverrideMagicDate")),
Date.Parse(ConfigurationManager.AppSettings("OverrideMagicDate")),
Date.Now)
In the file app.settings
, leave the value of OverrideMagicDate
empty if you want him to receive DateTime.Now
or enter the date you want:
<add key="OverrideMagicDate" value="" /><!-- DateTime.Now -->
or:
<add key="OverrideMagicDate" value="2012-01-13" /><!-- 13/01/2012 -->
It may be necessary to exchange Parse
for ParseExact
to have more control over date formats.
The Configurationmanager class is a good starting point. http://msdn.microsoft.com/en-us/library/System.Configuration.ConfigurationManager%28v=vs.110%29.aspx
– Joao Raposo
I updated the question with what I want. In this case, this information will not be very useful, because I already know that. Thanks for the tip, but in this case it won’t be what I need
– Filipe Vilhena
You want to parse the value?
– Miguel Angelo
I found the answer you wanted. 
 [http://stackoverflow.com/a/21778933/3206532][1]
 
 [1]: http://stackoverflow.com/a/21778933/3206532
– Filipe Vilhena