date inn = integer.valueof(trans.stdate.trim()) + integer.valueof(payment.Net__c);
Getting the following error System.TypeException: Invalid integer: 12/06/2012
Here trans.stdate is of string Type.& My Requirement is 12/06/2012 + 4 = 12/10/2012.
How can I acheive it
Attribution to: Eagerin Sf
Possible Suggestion/Solution #1
Well for starters Integer + Integer == Integer
so you'll never get a date with your current operation.
But if trans.stdate
is a String representation of a date your code should look something like:
Date inn = Date.parse(trans.stdate) + Integer.valueof(payment.Net__c);
There is also the Date.valueOf(string)
static method but that only accepts dates in the format yyyy-MM-dd so wouldn't match the format in your error message
Attribution to: Daniel Blackhall
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/5125