I am tr4ying to concatenate two date fields. But I'm getting this error: "Date expressions must use Integer or Long"
eg: System.debug(date.today()+date.today());
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It only takes a minute to sign up.
Sign up to join this communityYou can't directly add two dates together to get a String. You have to convert them to Strings first. By "adding" (+
) almost any type to a String, that calls the toString
method on the non-String operand, and the result is a String. The following example works:
System.debug(date.today()+''+date.today());
You need to provide Integer value of Long value to add to your Date.
For example - Date.today().addDays(1)
or Date.today() + 1
I am not sure what you are actually trying to achieve here. Please provide more information if it doesn't help.