SlideShare a Scribd company logo
1 of 17
How To: Have Fun
with Birthdates!
Beth Breisnes
@bethbrains
Consultant, Bigger Boat Consulting
…and date formulas!
Safe harbor statement under the Private Securities Litigation Reform Act of 1995:
This presentation may contain forward-looking statements
that involve risks, uncertainties, and assumptions. If any such
uncertainties materialize or if any of the assumptions proves
incorrect, the results of salesforce.com, inc. could differ
materially from the results expressed or implied by the
forward-looking statements we make. All statements other
than statements of historical fact could be deemed forward-
looking, including any projections of product or service
availability, subscriber growth, earnings, revenues, or other
financial items and any statements regarding strategies or
plans of management for future operations, statements of
belief, any statements concerning new, planned, or upgraded
services or technology developments and customer contracts
or use of our services.
The risks and uncertainties referred to above include – but
are not limited to – risks associated with developing and
delivering new functionality for our service, new products and
services, our new business model, our past operating losses,
possible fluctuations in our operating results and rate of
growth, interruptions or delays in our Web hosting, breach of
our security measures, the outcome of any litigation, risks
associated with completed and any possible mergers and
acquisitions, the immature market in which we operate, our
relatively limited operating history, our ability to expand,
retain, and motivate our employees and manage our growth,
new releases of our service and successful customer
deployment, our limited history reselling non-salesforce.com
products, and utilization and selling to larger enterprise
customers. Further information on potential factors that could
affect the financial results of salesforce.com, inc. is included
in our annual report on Form 10-K for the most recent fiscal
year and in our quarterly report on Form 10-Q for the most
recent fiscal quarter. These documents and others containing
important disclosures are available on the SEC Filings
section of the Investor Information section of our Web site.
Any unreleased services or features referenced in this or
other presentations, press releases or public statements are
not currently available and may not be delivered on time or at
all. Customers who purchase our services should make the
purchase decisions based upon features that are currently
available. Salesforce.com, inc. assumes no obligation and
does not intend to update these forward-looking statements.
Safe Harbor
Who cares about birthdays anyway?
Who cares about dates in general?
• Date functions
• Helpful math functions
• Calculate birthday this year
• Calculate next birthday
• Birthday monitoring
• Calculate age in years
• Calculate age in months
• Find last day of the month of a given date
• Calculate membership expiry date
Agenda
Unmanaged package at
bit.ly/happybirthdaydf15package
Don’t bother taking notes…
• Function Argument Return Data Type
• DAY(Date__c) Date__c Number
• MONTH(Date__c) Date__c Number
• YEAR(Date__c) Date__c Number
• TODAY() Date
• NOW() DateTime
• DATE(yyyy,mm,dd) 3 Numbers Date
• DATEVALUE() DateTime Date
Date Functions
• Function Argument Return Data Type
• MOD() 2 Numbers Number
• Returns the remainder after you divide by a specific divisor
• MOD(3,3) = 0
• MOD(4,3) = 1
• FLOOR() Number Number
• Rounds a number down to the nearest whole number
Math Functions
DATE(YEAR(TODAY()), MONTH(Birthdate), DAY(Birthdate))
Calculate Birthday This Year… maybe…
Find the month/day
Put it in this year
1. What if their birthday has
already passed?
2. What if they were born on a
leap day?
IF ( MONTH (Birthdate) = 2 && DAY (Birthdate) = 29,
IF ( DATE ( YEAR ( TODAY() ), 1, 1 ) + 59 > TODAY(),
DATE ( YEAR ( TODAY() ), 1, 1) + 59,
DATE ( YEAR ( TODAY() )+1, 1, 1) + 59),
IF (DATE (YEAR(TODAY()),MONTH(Birthdate),DAY(Birthdate)) > TODAY(),
DATE(YEAR(TODAY()),MONTH(Birthdate),DAY(Birthdate)),
DATE(YEAR(TODAY())+1,MONTH(Birthdate),DAY(Birthdate))
)
)
Calculate Next Birthday
FLOOR( ( TODAY() - Birthdate ) / 365.2425 )
Calculate Age based on Birthdate
Find number of days
Divide by 1 year, including Leap Year fraction
Round down
YEAR(TODAY()) - YEAR(DOB__c) –
IF(
OR (MONTH(TODAY()) < MONTH(DOB__c),
AND( MONTH(TODAY()) == MONTH(DOB__c),
DAY(TODAY()) < DAY(DOB__c)
)
),
1,
0
)
A Better Way to Calculate Age based on Birthdate
((YEAR( TODAY())*12) + MONTH(TODAY()))-
((YEAR(Birthdate)*12) + MONTH(Birthdate))-
IF(DAY(Birthdate)>DAY(TODAY()),
1,
0
)
Calculate Age in Completed Months
IF( MONTH( date ) = 12,
DATE( YEAR( date ), 12, 31 ),
DATE( YEAR( date ), MONTH ( date ) + 1, 1 ) - 1 )
If it’s December – this year, Dec 31.
Otherwise – this year, find next month’s 1st, come back 1 day.
Find the Last Day of the Month of a given Date
IF ( MONTH (Join_Date__c) = 2 && DAY (Join_Date__c) = 29,
Join_Date__c + 365,
DATE( YEAR(Join_Date__c) + 1, MONTH(Join_Date__c), DAY (Join_Date__c))
-1
)
Calculate Membership Expiry Date (add 1year-1day to a date)
Modified from Salesforce Saint
bit.ly/happybirthdaydf15package
Now go play!
Thank You

More Related Content

Similar to Fun with Date Functions, Formulas, and Birthdays

Similar to Fun with Date Functions, Formulas, and Birthdays (20)

Fearless Date Formulas: Leap Years and More by Beth Breisnes
Fearless Date Formulas: Leap Years and More by Beth BreisnesFearless Date Formulas: Leap Years and More by Beth Breisnes
Fearless Date Formulas: Leap Years and More by Beth Breisnes
 
Build AI-Powered Predictions with Einstein Prediction Builder
Build AI-Powered Predictions with Einstein Prediction BuilderBuild AI-Powered Predictions with Einstein Prediction Builder
Build AI-Powered Predictions with Einstein Prediction Builder
 
Ready... Set... Action! - Susan Thayer
Ready... Set... Action! - Susan ThayerReady... Set... Action! - Susan Thayer
Ready... Set... Action! - Susan Thayer
 
tdx20cosenhancingyourcrmwitheinsteinai1592951856546.pdf
tdx20cosenhancingyourcrmwitheinsteinai1592951856546.pdftdx20cosenhancingyourcrmwitheinsteinai1592951856546.pdf
tdx20cosenhancingyourcrmwitheinsteinai1592951856546.pdf
 
WT19: Fantastic Formulas to Make You a Salesforce Superhero
WT19: Fantastic Formulas to Make You a Salesforce SuperheroWT19: Fantastic Formulas to Make You a Salesforce Superhero
WT19: Fantastic Formulas to Make You a Salesforce Superhero
 
Enhancing Your Lightning Apps with Einstein Analytics
Enhancing Your Lightning Apps with Einstein AnalyticsEnhancing Your Lightning Apps with Einstein Analytics
Enhancing Your Lightning Apps with Einstein Analytics
 
Choose your Destiny - Building your Awesome Admin Career - Video Link: http:/...
Choose your Destiny - Building your Awesome Admin Career - Video Link: http:/...Choose your Destiny - Building your Awesome Admin Career - Video Link: http:/...
Choose your Destiny - Building your Awesome Admin Career - Video Link: http:/...
 
Triggers, Workflow, and Flows
Triggers, Workflow, and FlowsTriggers, Workflow, and Flows
Triggers, Workflow, and Flows
 
Modern Architectures: The Road to App Cloud 2020
Modern Architectures: The Road to App Cloud 2020Modern Architectures: The Road to App Cloud 2020
Modern Architectures: The Road to App Cloud 2020
 
Fantastic Formulas-Salesforce NY World tour
Fantastic Formulas-Salesforce NY World tourFantastic Formulas-Salesforce NY World tour
Fantastic Formulas-Salesforce NY World tour
 
Implementing a Content Strategy Is Like Running 100 Miles
Implementing a Content Strategy Is Like Running 100 MilesImplementing a Content Strategy Is Like Running 100 Miles
Implementing a Content Strategy Is Like Running 100 Miles
 
codeLive: Positive and negative testing
codeLive: Positive and negative testingcodeLive: Positive and negative testing
codeLive: Positive and negative testing
 
Are You Truly Ready for Your Salesforce Project?
Are You Truly Ready for Your Salesforce Project?Are You Truly Ready for Your Salesforce Project?
Are You Truly Ready for Your Salesforce Project?
 
Jax, FL Admin Group Presents: Spring '22 Release Highlights
Jax, FL Admin Group Presents: Spring '22 Release HighlightsJax, FL Admin Group Presents: Spring '22 Release Highlights
Jax, FL Admin Group Presents: Spring '22 Release Highlights
 
Admin Best Practices: Explore the Power of Data with Tableau
Admin Best Practices: Explore the Power of Data with TableauAdmin Best Practices: Explore the Power of Data with Tableau
Admin Best Practices: Explore the Power of Data with Tableau
 
NRF 2019: Chuck E. Cheese's Secret to Loyalty
NRF 2019: Chuck E. Cheese's Secret to LoyaltyNRF 2019: Chuck E. Cheese's Secret to Loyalty
NRF 2019: Chuck E. Cheese's Secret to Loyalty
 
Total Workforce Management: Digitizing Payroll for Administrative Excellence
Total Workforce Management: Digitizing Payroll for Administrative ExcellenceTotal Workforce Management: Digitizing Payroll for Administrative Excellence
Total Workforce Management: Digitizing Payroll for Administrative Excellence
 
Solo Admins: Getting Your Work Noticed - Kerry Townsend & Jodi Wagner
Solo Admins: Getting Your Work Noticed - Kerry Townsend & Jodi WagnerSolo Admins: Getting Your Work Noticed - Kerry Townsend & Jodi Wagner
Solo Admins: Getting Your Work Noticed - Kerry Townsend & Jodi Wagner
 
Integrating Social Media into Marketing and Sales Planning
Integrating Social Media into Marketing and Sales PlanningIntegrating Social Media into Marketing and Sales Planning
Integrating Social Media into Marketing and Sales Planning
 
Detroit ELEVATE Track 1
Detroit ELEVATE Track 1Detroit ELEVATE Track 1
Detroit ELEVATE Track 1
 

Recently uploaded

sourabh vyas1222222222222222222244444444
sourabh vyas1222222222222222222244444444sourabh vyas1222222222222222222244444444
sourabh vyas1222222222222222222244444444
saurabvyas476
 
Abortion pills in Riyadh Saudi Arabia (+966572737505 buy cytotec
Abortion pills in Riyadh Saudi Arabia (+966572737505 buy cytotecAbortion pills in Riyadh Saudi Arabia (+966572737505 buy cytotec
Abortion pills in Riyadh Saudi Arabia (+966572737505 buy cytotec
Abortion pills in Riyadh +966572737505 get cytotec
 
obat aborsi Tarakan wa 081336238223 jual obat aborsi cytotec asli di Tarakan9...
obat aborsi Tarakan wa 081336238223 jual obat aborsi cytotec asli di Tarakan9...obat aborsi Tarakan wa 081336238223 jual obat aborsi cytotec asli di Tarakan9...
obat aborsi Tarakan wa 081336238223 jual obat aborsi cytotec asli di Tarakan9...
yulianti213969
 
Abortion pills in Riyadh Saudi Arabia| +966572737505 | Get Cytotec, Unwanted Kit
Abortion pills in Riyadh Saudi Arabia| +966572737505 | Get Cytotec, Unwanted KitAbortion pills in Riyadh Saudi Arabia| +966572737505 | Get Cytotec, Unwanted Kit
Abortion pills in Riyadh Saudi Arabia| +966572737505 | Get Cytotec, Unwanted Kit
Abortion pills in Riyadh +966572737505 get cytotec
 
如何办理(WashU毕业证书)圣路易斯华盛顿大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(WashU毕业证书)圣路易斯华盛顿大学毕业证成绩单本科硕士学位证留信学历认证如何办理(WashU毕业证书)圣路易斯华盛顿大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(WashU毕业证书)圣路易斯华盛顿大学毕业证成绩单本科硕士学位证留信学历认证
acoha1
 
如何办理澳洲拉筹伯大学毕业证(LaTrobe毕业证书)成绩单原件一模一样
如何办理澳洲拉筹伯大学毕业证(LaTrobe毕业证书)成绩单原件一模一样如何办理澳洲拉筹伯大学毕业证(LaTrobe毕业证书)成绩单原件一模一样
如何办理澳洲拉筹伯大学毕业证(LaTrobe毕业证书)成绩单原件一模一样
wsppdmt
 
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi ArabiaIn Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
ahmedjiabur940
 
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Klinik kandungan
 
原件一样(UWO毕业证书)西安大略大学毕业证成绩单留信学历认证
原件一样(UWO毕业证书)西安大略大学毕业证成绩单留信学历认证原件一样(UWO毕业证书)西安大略大学毕业证成绩单留信学历认证
原件一样(UWO毕业证书)西安大略大学毕业证成绩单留信学历认证
pwgnohujw
 

Recently uploaded (20)

Unsatisfied Bhabhi ℂall Girls Vadodara Book Esha 7427069034 Top Class ℂall Gi...
Unsatisfied Bhabhi ℂall Girls Vadodara Book Esha 7427069034 Top Class ℂall Gi...Unsatisfied Bhabhi ℂall Girls Vadodara Book Esha 7427069034 Top Class ℂall Gi...
Unsatisfied Bhabhi ℂall Girls Vadodara Book Esha 7427069034 Top Class ℂall Gi...
 
sourabh vyas1222222222222222222244444444
sourabh vyas1222222222222222222244444444sourabh vyas1222222222222222222244444444
sourabh vyas1222222222222222222244444444
 
DAA Assignment Solution.pdf is the best1
DAA Assignment Solution.pdf is the best1DAA Assignment Solution.pdf is the best1
DAA Assignment Solution.pdf is the best1
 
Ranking and Scoring Exercises for Research
Ranking and Scoring Exercises for ResearchRanking and Scoring Exercises for Research
Ranking and Scoring Exercises for Research
 
Predictive Precipitation: Advanced Rain Forecasting Techniques
Predictive Precipitation: Advanced Rain Forecasting TechniquesPredictive Precipitation: Advanced Rain Forecasting Techniques
Predictive Precipitation: Advanced Rain Forecasting Techniques
 
SCI8-Q4-MOD11.pdfwrwujrrjfaajerjrajrrarj
SCI8-Q4-MOD11.pdfwrwujrrjfaajerjrajrrarjSCI8-Q4-MOD11.pdfwrwujrrjfaajerjrajrrarj
SCI8-Q4-MOD11.pdfwrwujrrjfaajerjrajrrarj
 
Jual Obat Aborsi Bandung (Asli No.1) Wa 082134680322 Klinik Obat Penggugur Ka...
Jual Obat Aborsi Bandung (Asli No.1) Wa 082134680322 Klinik Obat Penggugur Ka...Jual Obat Aborsi Bandung (Asli No.1) Wa 082134680322 Klinik Obat Penggugur Ka...
Jual Obat Aborsi Bandung (Asli No.1) Wa 082134680322 Klinik Obat Penggugur Ka...
 
Abortion pills in Riyadh Saudi Arabia (+966572737505 buy cytotec
Abortion pills in Riyadh Saudi Arabia (+966572737505 buy cytotecAbortion pills in Riyadh Saudi Arabia (+966572737505 buy cytotec
Abortion pills in Riyadh Saudi Arabia (+966572737505 buy cytotec
 
obat aborsi Tarakan wa 081336238223 jual obat aborsi cytotec asli di Tarakan9...
obat aborsi Tarakan wa 081336238223 jual obat aborsi cytotec asli di Tarakan9...obat aborsi Tarakan wa 081336238223 jual obat aborsi cytotec asli di Tarakan9...
obat aborsi Tarakan wa 081336238223 jual obat aborsi cytotec asli di Tarakan9...
 
RESEARCH-FINAL-DEFENSE-PPT-TEMPLATE.pptx
RESEARCH-FINAL-DEFENSE-PPT-TEMPLATE.pptxRESEARCH-FINAL-DEFENSE-PPT-TEMPLATE.pptx
RESEARCH-FINAL-DEFENSE-PPT-TEMPLATE.pptx
 
Abortion pills in Riyadh Saudi Arabia| +966572737505 | Get Cytotec, Unwanted Kit
Abortion pills in Riyadh Saudi Arabia| +966572737505 | Get Cytotec, Unwanted KitAbortion pills in Riyadh Saudi Arabia| +966572737505 | Get Cytotec, Unwanted Kit
Abortion pills in Riyadh Saudi Arabia| +966572737505 | Get Cytotec, Unwanted Kit
 
如何办理(WashU毕业证书)圣路易斯华盛顿大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(WashU毕业证书)圣路易斯华盛顿大学毕业证成绩单本科硕士学位证留信学历认证如何办理(WashU毕业证书)圣路易斯华盛顿大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(WashU毕业证书)圣路易斯华盛顿大学毕业证成绩单本科硕士学位证留信学历认证
 
如何办理澳洲拉筹伯大学毕业证(LaTrobe毕业证书)成绩单原件一模一样
如何办理澳洲拉筹伯大学毕业证(LaTrobe毕业证书)成绩单原件一模一样如何办理澳洲拉筹伯大学毕业证(LaTrobe毕业证书)成绩单原件一模一样
如何办理澳洲拉筹伯大学毕业证(LaTrobe毕业证书)成绩单原件一模一样
 
Case Study 4 Where the cry of rebellion happen?
Case Study 4 Where the cry of rebellion happen?Case Study 4 Where the cry of rebellion happen?
Case Study 4 Where the cry of rebellion happen?
 
Statistics Informed Decisions Using Data 5th edition by Michael Sullivan solu...
Statistics Informed Decisions Using Data 5th edition by Michael Sullivan solu...Statistics Informed Decisions Using Data 5th edition by Michael Sullivan solu...
Statistics Informed Decisions Using Data 5th edition by Michael Sullivan solu...
 
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi ArabiaIn Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
 
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
 
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
 
原件一样(UWO毕业证书)西安大略大学毕业证成绩单留信学历认证
原件一样(UWO毕业证书)西安大略大学毕业证成绩单留信学历认证原件一样(UWO毕业证书)西安大略大学毕业证成绩单留信学历认证
原件一样(UWO毕业证书)西安大略大学毕业证成绩单留信学历认证
 
Identify Rules that Predict Patient’s Heart Disease - An Application of Decis...
Identify Rules that Predict Patient’s Heart Disease - An Application of Decis...Identify Rules that Predict Patient’s Heart Disease - An Application of Decis...
Identify Rules that Predict Patient’s Heart Disease - An Application of Decis...
 

Fun with Date Functions, Formulas, and Birthdays

  • 1. How To: Have Fun with Birthdates! Beth Breisnes @bethbrains Consultant, Bigger Boat Consulting …and date formulas!
  • 2. Safe harbor statement under the Private Securities Litigation Reform Act of 1995: This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties materialize or if any of the assumptions proves incorrect, the results of salesforce.com, inc. could differ materially from the results expressed or implied by the forward-looking statements we make. All statements other than statements of historical fact could be deemed forward- looking, including any projections of product or service availability, subscriber growth, earnings, revenues, or other financial items and any statements regarding strategies or plans of management for future operations, statements of belief, any statements concerning new, planned, or upgraded services or technology developments and customer contracts or use of our services. The risks and uncertainties referred to above include – but are not limited to – risks associated with developing and delivering new functionality for our service, new products and services, our new business model, our past operating losses, possible fluctuations in our operating results and rate of growth, interruptions or delays in our Web hosting, breach of our security measures, the outcome of any litigation, risks associated with completed and any possible mergers and acquisitions, the immature market in which we operate, our relatively limited operating history, our ability to expand, retain, and motivate our employees and manage our growth, new releases of our service and successful customer deployment, our limited history reselling non-salesforce.com products, and utilization and selling to larger enterprise customers. Further information on potential factors that could affect the financial results of salesforce.com, inc. is included in our annual report on Form 10-K for the most recent fiscal year and in our quarterly report on Form 10-Q for the most recent fiscal quarter. These documents and others containing important disclosures are available on the SEC Filings section of the Investor Information section of our Web site. Any unreleased services or features referenced in this or other presentations, press releases or public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make the purchase decisions based upon features that are currently available. Salesforce.com, inc. assumes no obligation and does not intend to update these forward-looking statements. Safe Harbor
  • 3. Who cares about birthdays anyway?
  • 4. Who cares about dates in general?
  • 5. • Date functions • Helpful math functions • Calculate birthday this year • Calculate next birthday • Birthday monitoring • Calculate age in years • Calculate age in months • Find last day of the month of a given date • Calculate membership expiry date Agenda
  • 7. • Function Argument Return Data Type • DAY(Date__c) Date__c Number • MONTH(Date__c) Date__c Number • YEAR(Date__c) Date__c Number • TODAY() Date • NOW() DateTime • DATE(yyyy,mm,dd) 3 Numbers Date • DATEVALUE() DateTime Date Date Functions
  • 8. • Function Argument Return Data Type • MOD() 2 Numbers Number • Returns the remainder after you divide by a specific divisor • MOD(3,3) = 0 • MOD(4,3) = 1 • FLOOR() Number Number • Rounds a number down to the nearest whole number Math Functions
  • 9. DATE(YEAR(TODAY()), MONTH(Birthdate), DAY(Birthdate)) Calculate Birthday This Year… maybe… Find the month/day Put it in this year 1. What if their birthday has already passed? 2. What if they were born on a leap day?
  • 10. IF ( MONTH (Birthdate) = 2 && DAY (Birthdate) = 29, IF ( DATE ( YEAR ( TODAY() ), 1, 1 ) + 59 > TODAY(), DATE ( YEAR ( TODAY() ), 1, 1) + 59, DATE ( YEAR ( TODAY() )+1, 1, 1) + 59), IF (DATE (YEAR(TODAY()),MONTH(Birthdate),DAY(Birthdate)) > TODAY(), DATE(YEAR(TODAY()),MONTH(Birthdate),DAY(Birthdate)), DATE(YEAR(TODAY())+1,MONTH(Birthdate),DAY(Birthdate)) ) ) Calculate Next Birthday
  • 11. FLOOR( ( TODAY() - Birthdate ) / 365.2425 ) Calculate Age based on Birthdate Find number of days Divide by 1 year, including Leap Year fraction Round down
  • 12. YEAR(TODAY()) - YEAR(DOB__c) – IF( OR (MONTH(TODAY()) < MONTH(DOB__c), AND( MONTH(TODAY()) == MONTH(DOB__c), DAY(TODAY()) < DAY(DOB__c) ) ), 1, 0 ) A Better Way to Calculate Age based on Birthdate
  • 13. ((YEAR( TODAY())*12) + MONTH(TODAY()))- ((YEAR(Birthdate)*12) + MONTH(Birthdate))- IF(DAY(Birthdate)>DAY(TODAY()), 1, 0 ) Calculate Age in Completed Months
  • 14. IF( MONTH( date ) = 12, DATE( YEAR( date ), 12, 31 ), DATE( YEAR( date ), MONTH ( date ) + 1, 1 ) - 1 ) If it’s December – this year, Dec 31. Otherwise – this year, find next month’s 1st, come back 1 day. Find the Last Day of the Month of a given Date
  • 15. IF ( MONTH (Join_Date__c) = 2 && DAY (Join_Date__c) = 29, Join_Date__c + 365, DATE( YEAR(Join_Date__c) + 1, MONTH(Join_Date__c), DAY (Join_Date__c)) -1 ) Calculate Membership Expiry Date (add 1year-1day to a date) Modified from Salesforce Saint

Editor's Notes

  1. Course Name
  2. Constituent touchpoint opportunity Schools Summer camps Children’s programs Childcare referral agencies
  3. Membership dates Expiry dates Program dates Anniversaries
  4. Instructor Notes:
  5. Warning Who can find the 2 problems with doing it this way?
  6. If they were born on a leap day, Are we still before feb 29/mar 1? If so, Feb 29/Mar 1 of this year is their next birthday. If not, Feb 29/Mar 1 of NEXT year is their next birthday. If they weren’t born on a leap day, are we still before their next birthday? If so, their birthday’s month and day this year is their next birthday. If not, their birthday’s month and day NEXT year is their next birthday.
  7. Quick mental math – this year minus birth year, minus…. Either a 1 if their birthday hasn’t passed, or a 0 if it has passed. Check if it’s passed – if either today’s month is less than their birthday’s month OR it IS their birthday month but the day hasn’t passed yet.
  8. Same logic! Today’s year x 12 months + today’s month MINUS Birth year x 12 months + birth month MINUS Check if the birthdate day has already passed. If it has, less one. If it hasn’t, less zero.
  9. Doesn’t matter if it’s a 30/31/28/29 day month.
  10. If you joined on a leap day, Forward 365. Otherwise, same date next year, back up a calendar day. – allows for leap years, same logic as previous one – doesn’t matter if it’s a leap year or not.