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
IPFramptonIPFrampton 

Day number from date

Hi there,

I am looking to write a formula which allows me to put any date into the formula and return the day number in which that date is. All the solutions I have found thus far base themselves off Today which is not what I'm after. I want to be able to put in any date regardless of year and get the day number in which that date fell. 

Can anyone offer any suggestions as to how I would do this?
Best Answer chosen by IPFrampton
Tenacious BenTenacious Ben
I think this can be achieved with the following formula when applied to a custom field with a return type "number":
your_date_field__c - DATE(YEAR(your_date_field__c),1,1) + 1
Replace both instances of "your_date_field__c" with the date field you are comparing.  The formula will compare your date field to Jan 1 of the year of that date field and return the day number.

If this works for you, please be sure to mark this as the reply as the best answer.
 

All Answers

Tenacious BenTenacious Ben
I think this can be achieved with the following formula when applied to a custom field with a return type "number":
your_date_field__c - DATE(YEAR(your_date_field__c),1,1) + 1
Replace both instances of "your_date_field__c" with the date field you are comparing.  The formula will compare your date field to Jan 1 of the year of that date field and return the day number.

If this works for you, please be sure to mark this as the reply as the best answer.
 
This was selected as the best answer
IPFramptonIPFrampton
That's done the trick, thank you!