在salesforce中指定日期。

在salesforce中指定日期。,salesforce,Salesforce,我写了一批作业。在此批处理作业中,我有一个条件,即日期>=1/1/2012 我无法在查询中给出日期。你能帮帮我吗 global Database.QueryLocator startDatabase.BatchableContext BC{ system.debug('Inside start'); //date mydate = date.valueof(1/1/2012); return Database.getQueryLocator('select name

我写了一批作业。在此批处理作业中,我有一个条件,即日期>=1/1/2012 我无法在查询中给出日期。你能帮帮我吗

global Database.QueryLocator startDatabase.BatchableContext BC{

    system.debug('Inside start');

    //date mydate = date.valueof(1/1/2012);
    return Database.getQueryLocator('select  name from opportunity');
}
我有两种方法 第一个是: 将日期放入日期字段,并将条件设置为日期>=:mydate 将调试日志中的错误显示为无效日期:0 和 第二种方式,当我将日期本身指定为日期>=:2012年1月1日 它在调试日志中以意外标记的形式显示为错误:/

你能帮帮我吗

谢谢
Anu

您必须遵循正确的日期格式

YYYY-MM-DD

select name from opportunity where mydate >= 2012-01-01
更多信息