function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
bathybathy 

Date Formula giving Error

hi Guys,

I have a formula field to determine day of the date. I am trying to calculate day of the date which is a formula field. I used mod(Date__c- Date(1900,1,7) which is giving a decimal value which is not supposed to happen.
here is my formula, CASE(MOD(  X2_days_past_finance_extension_date2__c  - DATE(1900, 1, 6), 7), 0, "Saturday", 1, "Sunday", 2,"Monday", 3, "Tuesday", 4, "Wednesday", 5, "Thursday", 6,"Friday","Error")

X2_days_past_finance_extension_date2__c  is a formula field.
I dont have any idea why Mod function is giving decimal result. Any help is greatly appreciated guys.
Thanks,
praveen murugesanpraveen murugesan
Hello bathy,

Try with this,

CASE(MOD( DOB__c - DATE(1900, 1, 7), 7),
0, 'sunday',
1, 'monday',
2, 'tuesday',
3, 'wednesday',
4, 'thursday',
5, 'friday',
'saturday')


if its apex formula will be like this:

(datetime.newInstance(2014,12,12).format('EEE');

Thanks.

-- Praveen Murugesan
Mark this as solution if its helps.