You need to sign in to do that
Don't have an account?
Adrian-E
ServiceIssuesStartDate__c
S-Control functions (simple math question)
Hi,
I have a problem:
I have two date/time fields for when a service issue begins until it is resolved:
ServiceIssuesStartDate__c
ServiceIssuesEndDate__c
How do I create a new S-control that calculates only the number of minutes between the begin and end times and have this field in the case page layout?
Everything I do is giving me errors due to incompatible fields date and date/time don't go together.
Signed,
At a loss...
:)
1. Create date object for start date
2. Create date object for end date
3. Subtract Start Date from End Date (this gives you time in milliseconds)
4. Divide the milliseconds by the product of 1000 (to get seconds) * 60 (to get minutes)
Message Edited by bryano on 03-28-2007 06:24 PM
Sometimes date values can be tricky when doing calculations so if you still get errors with your dates after trying something like this function then you should create a separate function to break your passed date values down to month, day and year values then pass back the combined values in a single variable - then do your math calcs.
function getNumberOfMinutes(startDate, endDate) {
var start = new Date(startDate);
var end = new Date(endDate);
var minutes = (end - start) / (1000 * 60);
return minutes;
}
Then you would pass in your service issues dates to the function and what ever value is returned from getNumberOfMinutes(), set that value to the field on the Case and display it.