convert Datetime to simple Date
I am having trouble converting a variable that's in String format (from a
DateTime selector control on a form) to simple Date.
I am trying the conversion because I am getting the below error message:
INVALID_FIELD: \nAND c.Status__c = 'Closed' AND c.Close_Date__c >
2013-07-01T00:00:00Z\n ^\nERROR at Row:1:Column:326\nvalue of filter
criterion for field 'Close_Date__c' must be of type date and should not be
enclosed in quotes
I tried:
sQry += " AND c.Close_Date__c > " + DateTime.ParseExact(filterFromDate,
"d", CultureInfo.InvariantCulture) + " AND c.Close_Date__c < " +
DateTime.ParseExact(filterFromDate, "d", CultureInfo.InvariantCulture);
but it's not accepting it (compiler doesn't recognise CultureInfo.
where am I going wrong please?
No comments:
Post a Comment