Salesforce and other SMB Solutions are coming soon. ×

# Date Calculation

## Recommended Posts

I am trying to create a date calculation that will project a reckoning period date based on a penalty code. I know ... like ... shoving it to the workers smiley_cool . Here is what I have so far: if(PENALTY CODE="A" OR PENALTY CODE="B" OR PENALTY CODE="C",VIOLATION DATE+365,VIOLATION DATE+720)

This calc returns the date as a number like 733495.

The VIOLATION DATE+720 represents a "D" penalty that carries a 2 year reckoning period.

randyB911

##### Share on other sites

a) I assume that your desired output would look like a Date, not 733495? That's the problem? If that's NOT what you're writing about, please clarify.

b) This calc field.... is the result type definitely set to "Date", at the bottom of the formula window?

c) Is Violation Date definitely a Date field?

d) Do you really and truly want 365 days and 720 days, respectively, or would you perhaps prefer exactly one year and exactly two years, respectively, instead? If the latter:

TextToDate (Month(Violation Date) & "/" & Day(Violation Date) & "/" & (Year (Violation Date) + Case(PENALTY CODE="A" OR PENALTY CODE="B" OR PENALTY CODE="C", 1, 2) ) )

##### Share on other sites

Make sure the result of the calc is a Date, not a Number.

##### Share on other sites

a) I assume that your desired output would look like a Date, not 733495? That's the problem? If that's NOT what you're writing about, please clarify.

b) This calc field.... is the result type definitely set to "Date", at the bottom of the formula window?

c) Is Violation Date definitely a Date field?

d) Do you really and truly want 365 days and 720 days, respectively, or would you perhaps prefer exactly one year and exactly two years, respectively, instead? If the latter:

TextToDate (Month(Violation Date) & "/" & Day(Violation Date) & "/" & (Year (Violation Date) + Case(PENALTY CODE="A" OR PENALTY CODE="B" OR PENALTY CODE="C", 1, 2) ) )

IT WORKED smiley_cool smiley_cool smiley_cool

Thank you SO much !! This is exactly what I was looking for.

Have a GREAT DAY !!!

randyB911

##### Share on other sites

Actually it would fail on you IF the Violation Date happened to be February 29, 2008.

Better subtract a day FIRST if violation date happens to be a leap year.

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×

• ### Images

• By Soliant Consulting,
• By Soliant Consulting,
• By Soliant Consulting,
• ### Forum Statistics

• Total Topics
33.7k
• Total Posts
141.6k
×
×
• Create New...