I'm writing a function that gets a string with a date (format dd/mm/aaaa
) and it should return a date in the same format 4 weeks later.
Example:
Entrada: 07/04/2016
saída: 05/05/2016
I read about it and thought of the following logic:
Read the date and make the corresponding week an integer, add 4, and reverse the process.
Follow the code below:
//entrada 07/04/2016
private string CalcularDataEntrega(string dataEntrada)
{
//regra: Data Geração + 4 Semanas;
DateTime dataGen = DateTime.Parse(dataEntrada);
Calendar cal = new GregorianCalendar();
int semanaInicio = cal.GetWeekOfYear(dataGen); //erro
int semanaFim = semanaInicio + 4;
//retornar data com base na semana
string dataSaida; //o que colocar?
return dataSaida;
}
In this Example of the documentation Microsoft has not been clear what exactly this function GetWeekOfYear
returns (integer, string?).