简体   繁体   English

在caml查询中按日期排序

[英]sort by date in caml query

I want to sort my list items by date: 我想按日期对列表项进行排序:

I m using 我正在使用

<OrderBy><FieldRef Name='SortDate' Ascending='True'/></Order By>

but its giving me results randomly.Is it possible to sort by date in CAML if not then if there is any other way to retrieve list items sorted on the basis of date.... 但是它给了我随机结果。是否可以在CAML中按日期排序?如果没有其他方法可以检索基于日期排序的列表项...

Yes you can sort by date using CAML. 是的,您可以使用CAML按日期排序。 To test it out try sorting on the Modified field to see if that gets you better results. 要进行测试,请尝试对“已修改”字段进行排序,以查看是否可以获得更好的结果。 Is your SortDate field an actual DateTime field, or is it something else like a string? 您的SortDate字段是实际的DateTime字段,还是其他类似字符串的字段?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM