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
LeeCLeeC 

Display Years from two date fields

Hello, I have two date fields and I would like to display just the two years seperated by a -

 

e.g.

 

Date 1 = 1/1/2010

Date 2 = 2/2/2020

 

Formula Displays = "2010 - 2020"

 

Thanks in advance

Best Answer chosen by Admin (Salesforce Developers) 
Steve :-/Steve :-/

Here you go

 

DataType: Formula(Text)

Formula: 

 

 

TEXT(YEAR(Date_1__c)) + " - " + TEXT(YEAR(Date_2__c))

 

 PS.  You owe me a beer!

http://www.russianriverbrewing.com/web/brews/plinytheelder.htm 

 

All Answers

Steve :-/Steve :-/

Here you go

 

DataType: Formula(Text)

Formula: 

 

 

TEXT(YEAR(Date_1__c)) + " - " + TEXT(YEAR(Date_2__c))

 

 PS.  You owe me a beer!

http://www.russianriverbrewing.com/web/brews/plinytheelder.htm 

 

This was selected as the best answer
LeeCLeeC

Thank you! works a treat.

 

I will post you the beer :-)

Steve :-/Steve :-/
You can buy me one at Dreamforce '10
LeeCLeeC
Deal!