fearless date formulas: leap years and more by beth breisnes

27
Leap Years and More @bethbrains Beth Breisnes Consultant, Bigger Boat Consulting Fearless Date Formulas

Upload: salesforce-admins

Post on 13-Apr-2017

49 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: Fearless Date Formulas: Leap Years and More by Beth Breisnes

Leap Years and More

@bethbrains

Beth Breisnes Consultant, Bigger Boat

Consulting

Fearless Date Formulas

Page 2: Fearless Date Formulas: Leap Years and More by Beth Breisnes

Forward-Looking StatementsStatement 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.

Page 3: Fearless Date Formulas: Leap Years and More by Beth Breisnes

Who cares about dates?

Birthdays Membership dates Expiration dates Program dates Anniversaries

Page 4: Fearless Date Formulas: Leap Years and More by Beth Breisnes

Where we’re headed…

Key Date Functions 3 Key Considerations to avoid Leap Year errors Deep Dive on Two Bulletproof Date Formulas

BOO!

Page 5: Fearless Date Formulas: Leap Years and More by Beth Breisnes

HAPPY BIRTHDAY, ASTRO!

Page 6: Fearless Date Formulas: Leap Years and More by Beth Breisnes

The Date Function Machine

INPUT OUTPUT

Page 7: Fearless Date Formulas: Leap Years and More by Beth Breisnes

The Date Function Machine

Date Number

DAY(Date__c)

Page 8: Fearless Date Formulas: Leap Years and More by Beth Breisnes

The Date Function Machine

Date Number

MONTH(Date__c)

Page 9: Fearless Date Formulas: Leap Years and More by Beth Breisnes

The Date Function Machine

Date Number

YEAR(Date__c)

Page 10: Fearless Date Formulas: Leap Years and More by Beth Breisnes

The Date Function Machine

NOTHING Date

TODAY( )TODAY()

Page 11: Fearless Date Formulas: Leap Years and More by Beth Breisnes

The Date Function Machine

NOTHING DateTime

NOW( )NOW()

Page 12: Fearless Date Formulas: Leap Years and More by Beth Breisnes

The Date Function Machine

3 Numbers Date

DATE(yyyy,mm,dd)

Page 13: Fearless Date Formulas: Leap Years and More by Beth Breisnes

The Date Function Machine

DateTime Date

DATEVALUE(DateTime__c)

Page 14: Fearless Date Formulas: Leap Years and More by Beth Breisnes

The Date Function Machine

Ready for a test drive?

Page 15: Fearless Date Formulas: Leap Years and More by Beth Breisnes

The Date Function Machine

Oct 6, 2016 2016

YEAR(TODAY())

Page 16: Fearless Date Formulas: Leap Years and More by Beth Breisnes

The Date Function Machine

Oct 6, 2016

3:00 PM10

MONTH(DATEVALUE(NOW()))

Page 17: Fearless Date Formulas: Leap Years and More by Beth Breisnes

But isn’t date math easy?

OCT

1 + 5 =

OCT

6

Page 18: Fearless Date Formulas: Leap Years and More by Beth Breisnes

Membership/Contract Expiration Date (add 1year-1day to a date)

OCT

1 +364=

SEPT

30

Page 19: Fearless Date Formulas: Leap Years and More by Beth Breisnes

Membership/Contract Expiration Date (add 1year-1day to a date)

OCT

12015

+364=

SEPT

292016

O HAI!

Page 20: Fearless Date Formulas: Leap Years and More by Beth Breisnes

The Big Trap: Leap Years

When do leap years happen?

You don’t need to know!

Page 21: Fearless Date Formulas: Leap Years and More by Beth Breisnes

The Big Trap: Three Key Considerations

1. INPUTS2. OUTPUTS3. SPANS

Page 22: Fearless Date Formulas: Leap Years and More by Beth Breisnes

Calculate Membership/Contract Expiry 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 )

(add 1year-1day to a date)

Modified from Celeste Keller, Salesforce Saint

Page 23: Fearless Date Formulas: Leap Years and More by Beth Breisnes

Calculate Birthday This Year… maybe…

DATE(YEAR(TODAY()), MONTH(Birthdate), DAY(Birthdate))

(SPOILER ALERT: THIS IS A HORRIBLE FORMULA. DON’T USE THIS.)

Find the month/dayPut it in this year

WARNING!1. What if their birthday has

already passed this year?2. What if they were born on

a leap day?

Page 24: Fearless Date Formulas: Leap Years and More by Beth Breisnes

Calculate Next Birthday

IF ( MONTH (Birthdate) = 2 && DAY (Birthdate) = 29,

IF ( TODAY() < DATE ( YEAR ( TODAY() ), 1, 1 ) + 59,

DATE ( YEAR ( TODAY() ), 1, 1) + 59,

DATE ( YEAR ( TODAY() )+1, 1, 1) + 59),

IF ( TODAY() < DATE (YEAR(TODAY()),MONTH(Birthdate),DAY(Birthdate)),

DATE(YEAR(TODAY()),MONTH(Birthdate),DAY(Birthdate)),

DATE(YEAR(TODAY())+1,MONTH(Birthdate),DAY(Birthdate))

)

)

Page 25: Fearless Date Formulas: Leap Years and More by Beth Breisnes

Conquer Leap Years

Always consider your…1. Inputs2. Outputs3. Time spans

@bethbrains

LEAP YEAR

APPROVED

Page 26: Fearless Date Formulas: Leap Years and More by Beth Breisnes

Advanced Formulas

Page 27: Fearless Date Formulas: Leap Years and More by Beth Breisnes

Thank Y u