You need to sign in to do that
Don't have an account?
Mohan Raj 33
how to here changed the date to date time period
My Formula field:
Here I try to get the difference between the close date and Calculating Date.
but the close date is a date field and the Calculating date is a date/time field and the Total Time Difference is a Date/Time field.
So I have struggle to complete the task in getting difference in date and date/time fields so please help to solve this task.
For answers thanks in advance.
Total Time difference(Date/Time) = Date dCloseDate = System.CloseDate() DateTime dt = datetime.newInstance(dCloseDate.year(), dCloseDate.month(), dCloseDate.day()); Calculating_Date__c - dCloseDate;I have a three field in the Opportunity field the Close Date, Total Time Difference and Calculating Date respectively.
Here I try to get the difference between the close date and Calculating Date.
but the close date is a date field and the Calculating date is a date/time field and the Total Time Difference is a Date/Time field.
So I have struggle to complete the task in getting difference in date and date/time fields so please help to solve this task.
For answers thanks in advance.
Try this :
ABS( Calculating_Date__c -DATETIMEVALUE(dCloseDate))*24
Please let me know if this helps!
Thanks,
Apoorv
All Answers
First Convert your close date filed to date time as following
Datetime newInstance(Integer year, Integer month, Integer day, Integer hour, Integer minute, Integersecond)
Then use this calculate the datetime.
Regards
Sri
You can do that with a snippet like this
Hope that helps !
2 datetime difference is alsways number, not date time. so change you date time field to number data type use code below like
i hope you are using this in formula field not in apex code?
Calculating_Date__c -DATETIMEVALUE(dCloseDate)
hoope this will help you.
Thanks
karthik
Just like if I give close date 10/10/2016 and the calculating date is 12/10/2016 then the answer is in hour is difference of the two dates(in hours) and the difference of that two date's hours difference (plus this hour) in positive value(like 48 (for two days of 10 and 12) + two date's hours difference ). Thank you Mohan
Try this :
ABS( Calculating_Date__c -DATETIMEVALUE(dCloseDate))*24
Please let me know if this helps!
Thanks,
Apoorv
And I have a doubt if I try to calulate the current date (today) in instant of close date then what changes I have done this code.
And I also want to how the negative values are not come in now could you explain it's help to clear to understand me plz thank you.
You can use either of these :
ABS( Calculating_Date__c -DATETIMEVALUE(TODAY()))*24
or you can use NOW(), like:
ABS( Calculating_Date__c -NOW())*24
If you feel that your question was answered then do flag the appropriate answer as the solution to your query.
Thanks,
Apoorv