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

PDF
Pengaruh Kebisingan Terhadap Pegawai Bengkel Las Sinar Karya
PPTX
버전2 03 24 디자이너 상표 및 디자인 전문 새온특허
PPTX
2013 pci investment seminar presentation v1 dbv
PPTX
HR PPT Final
PPTX
03 24 디자이너 상표 및 디자인 전문 새온특허
PDF
PS 371 Research Project
PPT
Network grid
DOCX
قصة عن حالات التطابق في المثلث
Pengaruh Kebisingan Terhadap Pegawai Bengkel Las Sinar Karya
버전2 03 24 디자이너 상표 및 디자인 전문 새온특허
2013 pci investment seminar presentation v1 dbv
HR PPT Final
03 24 디자이너 상표 및 디자인 전문 새온특허
PS 371 Research Project
Network grid
قصة عن حالات التطابق في المثلث

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

PPTX
Fearless Date Formulas: Leap Years and More by Beth Breisnes
PDF
Steve mo's formulas and life hacks wellington nz 2020-05-05
PDF
Steve mo's formulas and life hacks frankfurt de 2020-05-07
PDF
Improve Your Salesforce Efficiency: Formulas for the Everyday Admin
PDF
Improve Your Salesforce Efficiency: Formulas for the Everyday Admin
PDF
Data Storytelling - Game changer for Analytics
PPTX
Storytelling for analytics | Naveen Gattu | CDAO Apex 2020
PDF
6 Reporting Formulas That Will Delight Your Users
PDF
DF16 Imprivata - Getting Started with Formulas
PDF
Best Online Age Calculator Tool.pdf image
PPTX
Fantastic Formulas-Salesforce NY World tour
PDF
WT19: Fantastic Formulas to Make You a Salesforce Superhero
PDF
Do you know what's in the data you're consuming
PPT
Aan009 Contreras 091907
PPTX
Data visualization for social problems
DOCX
3 M I N U T E R E A D7 Ways To Lie WithStatistics And .docx
PDF
Data scientist
PDF
Facebook Targeting By The Numbers
PDF
Happy Birthday from Neonway
PDF
Become a Formula Ninja
Fearless Date Formulas: Leap Years and More by Beth Breisnes
Steve mo's formulas and life hacks wellington nz 2020-05-05
Steve mo's formulas and life hacks frankfurt de 2020-05-07
Improve Your Salesforce Efficiency: Formulas for the Everyday Admin
Improve Your Salesforce Efficiency: Formulas for the Everyday Admin
Data Storytelling - Game changer for Analytics
Storytelling for analytics | Naveen Gattu | CDAO Apex 2020
6 Reporting Formulas That Will Delight Your Users
DF16 Imprivata - Getting Started with Formulas
Best Online Age Calculator Tool.pdf image
Fantastic Formulas-Salesforce NY World tour
WT19: Fantastic Formulas to Make You a Salesforce Superhero
Do you know what's in the data you're consuming
Aan009 Contreras 091907
Data visualization for social problems
3 M I N U T E R E A D7 Ways To Lie WithStatistics And .docx
Data scientist
Facebook Targeting By The Numbers
Happy Birthday from Neonway
Become a Formula Ninja
Ad

Recently uploaded (20)

PPTX
IMPACT OF LANDSLIDE.....................
PDF
©️ 02_SKU Automatic SW Robotics for Microsoft PC.pdf
PPTX
ai agent creaction with langgraph_presentation_
PDF
Microsoft 365 products and services descrption
PDF
An essential collection of rules designed to help businesses manage and reduc...
PDF
Jean-Georges Perrin - Spark in Action, Second Edition (2020, Manning Publicat...
PPTX
eGramSWARAJ-PPT Training Module for beginners
DOCX
Factor Analysis Word Document Presentation
PPTX
Machine Learning and working of machine Learning
PPTX
Caseware_IDEA_Detailed_Presentation.pptx
PPTX
Crypto_Trading_Beginners.pptxxxxxxxxxxxxxx
PPTX
Tapan_20220802057_Researchinternship_final_stage.pptx
PDF
Microsoft Core Cloud Services powerpoint
PPTX
Phase1_final PPTuwhefoegfohwfoiehfoegg.pptx
PDF
Global Data and Analytics Market Outlook Report
PDF
Votre score augmente si vous choisissez une catégorie et que vous rédigez une...
PDF
Systems Analysis and Design, 12th Edition by Scott Tilley Test Bank.pdf
PDF
Navigating the Thai Supplements Landscape.pdf
PPT
statistic analysis for study - data collection
PPTX
CHAPTER-2-THE-ACCOUNTING-PROCESS-2-4.pptx
IMPACT OF LANDSLIDE.....................
©️ 02_SKU Automatic SW Robotics for Microsoft PC.pdf
ai agent creaction with langgraph_presentation_
Microsoft 365 products and services descrption
An essential collection of rules designed to help businesses manage and reduc...
Jean-Georges Perrin - Spark in Action, Second Edition (2020, Manning Publicat...
eGramSWARAJ-PPT Training Module for beginners
Factor Analysis Word Document Presentation
Machine Learning and working of machine Learning
Caseware_IDEA_Detailed_Presentation.pptx
Crypto_Trading_Beginners.pptxxxxxxxxxxxxxx
Tapan_20220802057_Researchinternship_final_stage.pptx
Microsoft Core Cloud Services powerpoint
Phase1_final PPTuwhefoegfohwfoiehfoegg.pptx
Global Data and Analytics Market Outlook Report
Votre score augmente si vous choisissez une catégorie et que vous rédigez une...
Systems Analysis and Design, 12th Edition by Scott Tilley Test Bank.pdf
Navigating the Thai Supplements Landscape.pdf
statistic analysis for study - data collection
CHAPTER-2-THE-ACCOUNTING-PROCESS-2-4.pptx
Ad

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

  • #2: Course Name
  • #4: Constituent touchpoint opportunity Schools Summer camps Children’s programs Childcare referral agencies
  • #5: Membership dates Expiry dates Program dates Anniversaries
  • #6: Instructor Notes:
  • #10: Warning Who can find the 2 problems with doing it this way?
  • #11: 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.
  • #13: 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.
  • #14: 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.
  • #15: Doesn’t matter if it’s a 30/31/28/29 day month.
  • #16: 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.