I am developing a program where there is a 15-day trial period.
When the user registers an account in the application, it takes the internet date and registers the current date and end date of the test period, which is 15 days after the current date, in the database.
data_registro | data_vencimento 01/06/2017 | 16/06/2017
How do I compare the date provided by this code:
public static DateTime DataAtual()
{
var myHttpWebRequest = (HttpWebRequest)WebRequest.Create("http://www.microsoft.com");
var response = myHttpWebRequest.GetResponse();
string todaysDates = response.Headers["date"];
return DateTime.ParseExact(todaysDates,
"ddd, dd MMM yyyy HH:mm:ss 'GMT'",
CultureInfo.InvariantCulture.DateTimeFormat,
DateTimeStyles.AssumeUniversal);
}
The code above is returned by this code: DataAtual().ToShortDateString();
which results in: 06/01/2017
With the database, in the field: data_vencimento
to validate whether or not the test period has expired?