1

我正在使用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"
  • 如何发送一个 datetype 对象来查询和解决这个问题?
4

2 回答 2

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

于 2012-08-16T19:26:42.163 回答
0

这将为您提供一个日期时间对象:

import datetime

def return_datetime(year, month, day):
    return datetime.datetime(year, month, day)

date = return_datetime(2012, 8, 12)
于 2012-08-16T19:15:34.530 回答