You need to sign in to do that
Don't have an account?
Karthik Pathaneni
Adding days to a Date/Time field
Hi,
I have a requirement where I have to add my custom Expiration Date with 90 days from submission Date field. but when I have created a workflow with the following field action it is updating the value of the expiration date with 90 days but an hour less.
Workflow Field Update Action : Submission_Date__c + 90
suppose my submission date is 10/10/2013 2:30AM'
then the expiration Date is getting updated as 01/08/2014 1:30AM whereas ideally it should get updated as 01/08/2014 2:30AM.
Please let me know any pointers in that.
Thanks,
Karthik
Submission_Date__c = Submission_Date__c.addDays(90);
refer below link:
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_System_Date_addDays.htm
Hi Dhaval,
I am using a workflow for the field update and not a class. AddDays(x) method is not working on the workflow. Please let me know how I can proceed in a workflow.
I have changed the formula to Submission_Date__c +90 + (60/1440) which will add an hour to the expiration date. But please let me know why exactly is (Submission_Date__c +90) not working.
Thanks,
Karthik
Hi Dhaval,
I am using a workflow for the field update and not a class. AddDays(x) method is not working on the workflow. Please let me know how I can proceed in a workflow.
I have changed the formula to Submission_Date__c +90 + (60/1440) which will add an hour to the expiration date. But please let me know why exactly is (Submission_Date__c +90) not working.
Thanks,
Karthik
I tried below example in workflow and it worked for me.
DATEVALUE( TEXT( CreatedDate ) ) + 90
I have created one date type field "Expiration Date" and updated it by adding 90 days to created date.
Here created date is of type dateTime so i have converted it to Date type and then added 90 days and it worked fine for me.
Well, if its a datetime field it would require the field value to be returned as date/time rather than date type.
So there is a formula for doing this would be something like (( (<number of hours>) * 60) + <number of mins> )/1440
So your fornula should be Submission_Date__c + (( (24* 90) * 60) + 0> )/1440
Thats it. I am sure this will solve your issue. If it does and if like my answer please mark it as solution and click the star to add kudos.
The formula expression is invalid: Syntax error. Found ')'
Thanks