0

I am trying to figure out how to warn a player if their trial period is about to end. I would like to give them a heads up about 7 days before.

Here is what I have so far:

DateTime now = DateTime.UtcNow;

string currDate = now.ToString("yyyyMMddHHmmss");
string trialDate = "20190320104842"; // This is how dates are saved in the DB

DateTime addDays = now.AddDays(-7);
string headupDate = addDays.ToString("yyyyMMddHHmmss");


if (System.Int64.Parse(currDate) > System.Int64.Parse(trialDate))
{
    print("TIME RAN OUT");
} 
else if( // NOT SURE WHAT TO USE HERE // )
{
    print("TIME RUNS OUT IN 7 DAYS");
}
else
{
    print("TIME STILL RUNNING");
}

Not sure how to calculate if time is within the 7 day limit?

Any help is appreciated and thanks in advance :-)

Mansa
  • 2,277
  • 10
  • 37
  • 67

0 Answers0