title: Odata $filter for the date in the Office 365 REST API
body: <p>I'm trying to retrieve events for a user from its Office 365 account using the REST API but filtered by the field "Start". For instance, retrieve all the events that will happen after the date: 2014-08-29T09:13:28' but i'm always retrieving this error message</p>
  
  <pre><code>{
    "error": {
      "code": "ErrorInvalidUrlQuery",
      "message": "The query parameter '$filter' is invalid.",
      "innererror": {
        "message": "The query parameter '$filter' is invalid.",
        "type": "Microsoft.Exchange.Services.OData.InvalidUrlQueryException",
        "stacktrace": " at Microsoft.Exchange.Services.OData.Web.ODataQueryOptions.Populate()
   at Microsoft.Exchange.Services.OData.ODataContext..ctor(HttpContext httpContext, Uri requestUri, ServiceModel serviceModel, ODataPathWrapper odataPath, ODataUriParser odataUriParser)
   at Microsoft.Exchange.Services.OData.Web.RequestBroker.InitializeODataContext()
   at Microsoft.Exchange.Services.OData.Web.RequestBroker.Process()",
        "internalexception": {
          "message": "A binary operator with incompatible types was detected. Found operand types 'Edm.DateTimeOffset' and 'Edm.Int32' for operator kind 'Equal'.",
          "type": "Microsoft.OData.Core.ODataException",
          "stacktrace": " at Microsoft.OData.Core.UriParser.Parsers.BinaryOperatorBinder.PromoteOperandTypes(BinaryOperatorKind binaryOperatorKind, SingleValueNode&amp; left, SingleValueNode&amp; right)
   at Microsoft.OData.Core.UriParser.Parsers.BinaryOperatorBinder.BindBinaryOperator(BinaryOperatorToken binaryOperatorToken)
   at Microsoft.OData.Core.UriParser.Parsers.MetadataBinder.Bind(QueryToken token)
   at Microsoft.OData.Core.UriParser.Parsers.FilterBinder.BindFilter(QueryToken filter)
   at Microsoft.OData.Core.UriParser.ODataUriParser.ParseFilterImplementation(String filter, IEdmType elementType, IEdmNavigationSource navigationSource)
   at Microsoft.OData.Core.UriParser.ODataUriParser.ParseFilter()
   at Microsoft.Exchange.Services.OData.Web.ODataQueryOptions.Populate()"
        }
      }
    }
  }
  </code></pre>
  
  <p>Here all the thing i've tried:</p>
  
  <p>[ressource]=<a href="https://outlook.office365.com/" rel="nofollow">https://outlook.office365.com/</a></p>
  
  <blockquote>
    <p>url: [ressource]EWS/OData/Me/Events?$filter=Start%20eq%20DateTime'2012-05-29T09:13:28'</p>
    
    <p>url: [ressource]EWS/OData/Me/Events?$filter=Start%20eq%20DateTime'20141231'</p>
    
    <p>url: [ressource]EWS/OData/Me/Events?$filter=month(Start)%20eq%2012</p>
  </blockquote>
  
  <p>And i've tried the $filter on string field or the $select on the field <em>Start</em> and it worked perfectly so i think my error is caused by the date format but i don't know how to solve it, so if anybody could help me on that, it woud be great!</p>
  
  <p>Thank you!</p>