I have a table in the database that holds two dates,
first field: startdate = "1400/01/08" second field: enddate = after flowing calcute...
And in this table I have a field that is of the byte type
AllowField = "0"
1-I want to get today's date,If the months of todays date was between 01 and 06...
for example: var six1 = "1400/01/01,
I want to multiply "six1" by "31": for example: var resualt1 = "1400/01/01 * 31 = 1400/02/01" and saved "resualt1" in "enddate" field
2-If the months of todays date was between 07 and 12...
for example: var six2 = "1400/07/01,
I want to multiply "six2" by "30": for example: var resualt2 = "1400/07/01 * 30 = 1400/08/01" and saved "resualt2" in "enddate" field
And I want to load the form if today's date was not between "startdate" and "enddate"
"AllowField" Automatically change its value to 1 and Conversely؟
CodePudding user response:
The DateTime class in C# has a method called AddMonths.
var thisDayNextMonth = currentDate.AddMonths(1);
Please do not homebrew a weird solution. Standard problems have standard solutions and in C# they are really easy to find and not obscure at all.
