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
https://forums.phpfreaks.com/topic/248381-field-calculation-formula/
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

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.

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.