我正在使用beatbox从Python连接到Salesforce,它可以正常工作,直到我尝试添加带日期的约束。
当我添加CreatedDate约束时,它无法说
File "/Library/Python/2.7/site-packages/beatbox/_beatbox.py", line 332, in post
raise SoapFaultError(faultCode, faultString)
beatbox._beatbox.SoapFaultError: 'INVALID_FIELD' "INVALID_FIELD: from Assets__c where CreatedDate > 2012-08-08 ^ ERROR at Row:1:Column:1061 value of filter criterion for field 'CreatedDate' must be of type dateTime and should not be enclosed in quotes"
答案 0 :(得分:1)
刚才意识到,它需要采用SFDC格式的日期 - 2012-08-15T00:00:00+00:00
参考 - http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_soql_select_dateformats.htm
答案 1 :(得分:0)
这将为您提供日期时间对象:
import datetime
def return_datetime(year, month, day):
return datetime.datetime(year, month, day)
date = return_datetime(2012, 8, 12)