zohab Posted October 4, 2011 Share Posted October 4, 2011 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? Quote Link to comment https://forums.phpfreaks.com/topic/248381-field-calculation-formula/ Share on other sites More sharing options...
Deoctor Posted October 4, 2011 Share Posted October 4, 2011 Could not able to get what you exactly want here. Quote Link to comment https://forums.phpfreaks.com/topic/248381-field-calculation-formula/#findComment-1275502 Share on other sites More sharing options...
zohab Posted October 4, 2011 Author Share Posted October 4, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/248381-field-calculation-formula/#findComment-1275506 Share on other sites More sharing options...
Muddy_Funster Posted October 4, 2011 Share Posted October 4, 2011 I'd start with reading up on PHP date functions, DateTime::Add() would be a likely place to begin I think. Quote Link to comment https://forums.phpfreaks.com/topic/248381-field-calculation-formula/#findComment-1275513 Share on other sites More sharing options...
zohab Posted October 4, 2011 Author Share Posted October 4, 2011 Any solution? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/248381-field-calculation-formula/#findComment-1275571 Share on other sites More sharing options...
Nodral Posted October 4, 2011 Share Posted October 4, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/248381-field-calculation-formula/#findComment-1275575 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.