Jump to content
Salesforce and other SMB Solutions are coming soon. ×

Date Calculation


randyB911

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.

 

thanks in advance,

 

randyB911

Link to comment
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) ) )

Link to comment
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

Link to comment
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.

Link to comment
Share on other sites

This thread is quite old. Please start a new thread rather than reviving this one.

Join the conversation

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

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

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



×
×
  • Create New...

Important Information

Terms of Use