You need to sign in to do that
Don't have an account?

How to solve System.TypeException: Invalid date/time issue
Hi i've a custom field called lastmodifiedcom__c in Task object.
But when i'm trying to set myTaskObj.lastmodifiedcom__c value it gives
System.TypeException: Invalid date/time error..
This is my code
String systemDate=System.now().format('yyyy-MM-ddHH:mm:ss');
system.debug('TIMEDATE IS'+systemDate);
myTaskObj.lastmodifiedcom__c = DateTime.parse(systemDate);
Thank you very much
But when i'm trying to set myTaskObj.lastmodifiedcom__c value it gives
System.TypeException: Invalid date/time error..
This is my code
String systemDate=System.now().format('yyyy-MM-ddHH:mm:ss');
system.debug('TIMEDATE IS'+systemDate);
myTaskObj.lastmodifiedcom__c = DateTime.parse(systemDate);
Thank you very much
Why are you not directly using this code :
myTaskObj.lastmodifiedcom__c = system.now();
Please check and let me know if you have any issue.
Thanks,
Abhishek.
format('yyyy-MM-dd HH:mm:ss')
As a common practice, if your question is answered, please choose 1 best answer.
But you can give every answer a thumb up if that answer is helpful to you.
Thanks