You need to sign in to do that
Don't have an account?
ssurfer
How to calculate Bank days in salesforce?
Hi,
I've got a small problem. In a team edition of salesforce, i've got a standard field under opportunities called close date. I was to create a custom formula field that gives me the date 5 bank days from the close date. This means skipping saturday and sunday. I've not been able to solve this, does anyone have any ideas how i can do it?
Best regards,
johan
I recommend logging a feature request.
Sorry.
He's right you know. This seems to work:
private static Date knownMonday = Date.newInstance(2009, 1, 5); public static Boolean isSaturday(Date d) { // daysBetween() is always positive Integer diff = knownMonday.daysBetween(d); return (Math.mod(diff, 7) == 2); } public static Boolean isSunday(Date d) { Integer diff = knownMonday.daysBetween(d); return (Math.mod(diff, 7) == 1); } public static Boolean isMonday(Date d) { Integer diff = knownMonday.daysBetween(d); return (Math.mod(diff, 7) == 0); }
Sorry, I mean this:
private static Date knownSaturday = Date.newInstance(2009, 1, 10); private static Date knownSunday = Date.newInstance(2009, 1, 11); public static Boolean isSaturday(Date d) { // daysBetween() is always positive Integer diff = knownSaturday.daysBetween(d); return (Math.mod(diff, 7) == 0); } public static Boolean isSunday(Date d) { Integer diff = knownSunday.daysBetween(d); return (Math.mod(diff, 7) == 0); }