Jump to content

Field calculation formula


zohab

Recommended Posts

Hi,

 

I need field calculation formula.

 

I have following four fields. I want to calculate End Date based on values in Tracking Unit, Total Units and Start Date.

 

Tracking Unit (Daily,Weekly,Monthly,Quarterly)

 

for example

 

Tracking Unit => Monthly

Total Units => 12

Start Date => 2011-01-01

End Date => 2011-12-01

 

another example

 

Tracking Unit => Weekly

Total Units => 12

Start Date => 2011-01-01

End Date => ?

 

I want to calculate End Date either in PHP or Javascript.

 

Any idea?

Link to comment
Share on other sites

Hi,

 

In following example Tracking Unit is Monthly and Total Units  is 12

 

therefore we will add 12 months in Start date 2011-01-01

 

so End Date will be after adding 12 months in Start date 2011-12-01.

 

Same way I want to calculate End Date based on values in Tracking Unit, Total Units and Start Date.

 

Tracking Unit => Monthly

Total Units => 12

Start Date => 2011-01-01

End Date => 2011-12-01

Link to comment
Share on other sites

Use a SWITCH statement to create a variable which is how much you need to add to the current date (i.e. days, months, years) then using the DateTime functions as mentioned by Muddy_funster you'll be able to sort your problem.

 

PS  We're not here to do your work for you, you'll need to put some effort in yourself rather than just asking for us to give you the solution.

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.