Windchill REST Services Framework Capabilities > Support for OData > Querying with the DateTimeOffset Property
Querying with the DateTimeOffset Property
Windchill REST Services enables the DateTimeOffset property to be used in $filter expressions. Windchill enables DateTimeOffset properties to be persisted in the database. . Windchill stores all the DateTimeOffset properties in UTC format.
When you query with DateTimeOffset property in $filter expressions, you must specify both the date and time in UTC format. Windchill REST Services returns an error if the date and time properties in $filter expressions are specified in any other time zone.
To query both the date and time portion of the DateTimeOffset property you must also specify the custom parameter ptc.search.allowFilterOnTime and set it to true. If you do not specify a value for ptc.search.allowFilterOnTime or set the value to false then the $filter expression returns only the date portion of the DateTimeOffset property. For example, if you specify the expression $filter=CreatedOn eq 2018-01-20T01:52:16Z, the service qualifies all the entities created on January 20, 2018, in the UTC time zone regardless of the time specified in the expression.
For example, the URL used in $filter expression with DateTimeOffset property is:
/Windchill/servet/odata/ProdMgmt/Parts?$filter=CreatedOn eq 2018-01-20T00:00:00Z
To view all the parts created on a specific date and at a particular time, set the value of the parameter ptc.search.allowFilterOnTime to true as shown in this example:
/Windchill/servlet/odata/ProdMgmt/Parts?$filter=CreatedOn
eq 2019-06-07T08:30:57Z &ptc.search.allowFilterOnTime=true
.