回复:Salesforce Apex:日期

问题描述 投票:0回答:1

回复:Salesforce Apex:日期

不断收到此错误消息。

编译错误:变量不存在:你好 线路:6

public with sharing class Solution {
  private String dateAsString = '2019-01-01 00:00:00';

  public Integer getDay(Date someDate) {
    Date hello = Date.newInstance(2024, 7, 11);
    return hello;
  }
}
salesforce apex apex-code
1个回答
0
投票

不要将你的类命名为

Solution
,这是标准对象的名称。就像
public Integer Account = 5; // happy debugging suckers

在尝试部署之前,您确定文件已保存(在您的磁盘上)正常吗?我越来越

Illegal conversion from Date to Integer (6:7)

但是如果我将该行更改为

return hello.day();
它可以编译正常。

© www.soinside.com 2019 - 2024. All rights reserved.