This is a quick post on how to search SharePoint DateTime column using incorporating a DateTime object inside a CAML query.
CAML is Collaborative Application Markup Language is a XML based language that can be used by developers to build, customise and query web sites in SharePoint Services.
You can use SPUtility.CreateISO8601DateTimeFromSystemDateTime to ensure the DateTime object passed by you is in the format acceptable by SharePoint.
Dim CurrDate As String = SPUtility.CreateISO8601DateTimeFromSystemDateTime(DateTime.Now) Dim _Qry As SPQuery = New SPQuery _Qry.Query = "<Where>" & _ "<Eq>" & _ "<FieldRef Name='Published_x0020_Date' />" & _ "<Value Type='Datetime'>" & CurrDate & "</Value>" & _ "</Eq>" & _ "</Where>"
In the code above, I have used a CAML query to find if Published Date column has today’s date. To use SPUtility the following needs to be added
You can also use it like.