title: Retrieve complete LUIS DateTimeV2 entity from recognizer
body: <p>I'm using the Microsoft Bot Framework v4 to do some fairly basic date and date range recognition.</p>
  
  <p>The most straightforward use of the LUIS recognizer that most examples use and is used in the enterprise template doesn't return the complete DateTimeV2 structure.  The example below is for "last week" corresponding to a daterange.  These results are in recognizer.result.entities:</p>
  
  <pre><code>{
    "$instance": {
      "datetime": [
        {
          "startIndex": 8,
          "endIndex": 17,
          "text": "last week",
          "type": "builtin.datetimeV2.daterange"
        }
      ]
    },
    "datetime": [
      {
        "type": "daterange",
        "timex": [
          "2018-W43"
        ]
      }
    ]
  }
  </code></pre>
  
  <p>Notice there are no start / end tags for the date range.  This seems like an incomplete version of the DateTime2 specification. <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/LUIS/luis-reference-prebuilt-datetimev2" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/azure/cognitive-services/LUIS/luis-reference-prebuilt-datetimev2</a></p>
  
  <p>If I use the specific DateTime resolver, I get the more detailed start and end information that I want.</p>
  
  <pre><code>[timex, 2018-W43]
  [type, daterange]
  [start, 2018-10-22]
  [end, 2018-10-29]
  </code></pre>
  
  <p>It seems like these steps are nearly redundant as the more general approach returns the Timex formatted string that contains start and end information but not in an easily used format.</p>
  
  <p>I believe I'm missing something fundamental about configuring LUIS and recognizers.</p>
  
  <p>The code snippet below is modified version of the csharp_dotnetcore / 12.nlp-with-luis example (<a href="https://github.com/Microsoft/BotBuilder-Samples/tree/master/samples/csharp_dotnetcore/12.nlp-with-luis" rel="nofollow noreferrer">https://github.com/Microsoft/BotBuilder-Samples/tree/master/samples/csharp_dotnetcore/12.nlp-with-luis</a>)</p>
  
  <p>I added single prebuilt DateTimeV2 entity within luis.ai.</p>
  
  <pre><code>public async Task OnTurnAsync(ITurnContext turnContext, CancellationToken cancellationToken = default(CancellationToken))
  {
      IList&lt;Dictionary&lt;string, string&gt;&gt; resolutionValues = null;
  
      if (turnContext.Activity.Type == ActivityTypes.Message)
      {
  
          // Use the more generic approach.
          var recognizerResult = await _services.LuisServices[LuisKey].RecognizeAsync(turnContext, cancellationToken);
          var topIntent = recognizerResult?.GetTopScoringIntent();
          if (topIntent != null &amp;&amp; topIntent.HasValue &amp;&amp; topIntent.Value.intent != "None")
          {
              await turnContext.SendActivityAsync($"==&gt;LUIS Top Scoring Intent: {topIntent.Value.intent}, Score: {topIntent.Value.score}\n");
              if (recognizerResult.Entities != null)
              {
                  await turnContext.SendActivityAsync($"==&gt;LUIS Entities Found: {recognizerResult.Entities.ToString()}\n");
              }
          }
          else
          {
              var msg = @"No LUIS intents were found. Try show me last week.";
              await turnContext.SendActivityAsync(msg);
          }
  
          // Check LUIS model using specific DateTime Recognizer.
          var culture = Culture.English;
          var r = DateTimeRecognizer.RecognizeDateTime(turnContext.Activity.Text, culture);
          if (r.Count &gt; 0 &amp;&amp; r.First().TypeName.StartsWith("datetimeV2"))
          {
              var first = r.First();
              resolutionValues = (IList&lt;Dictionary&lt;string, string&gt;&gt;)first.Resolution["values"];
              var asString = string.Join(";", resolutionValues[0]);
              await turnContext.SendActivityAsync($"==&gt;LUIS: resolutions values: {asString}\n");
              var subType = first.TypeName.Split('.').Last();
              if (subType.Contains("date") &amp;&amp; !subType.Contains("range"))
              {
                  // a date (or date &amp; time) or multiple
                  var moment = resolutionValues.Select(v =&gt; DateTime.Parse(v["value"])).FirstOrDefault();
                  await turnContext.SendActivityAsync($"==&gt;LUIS DateTime Moment: {moment}\n");
              }
              else if (subType.Contains("date") &amp;&amp; subType.Contains("range"))
              {
                  // range
                  var from = DateTime.Parse(resolutionValues.First()["start"]);
                  var to = DateTime.Parse(resolutionValues.First()["end"]);
                  await turnContext.SendActivityAsync($"==&gt;LUIS DateTime Range: from: {from} to: {to}\n");
              }
          }
      }
      else if (turnContext.Activity.Type == ActivityTypes.ConversationUpdate)
      {
          // Send a welcome message to the user and tell them what actions they may perform to use this bot
          await SendWelcomeMessageAsync(turnContext, cancellationToken);
      }
      else
      {
          await turnContext.SendActivityAsync($"{turnContext.Activity.Type} event detected", cancellationToken: cancellationToken);
      }
  }
  </code></pre>
  
  <p>Is there a straightforward way to get the more complete DateTimeV2 entity out of the more general recognizer?  Possibly chaining recognizers?</p>