This topic is locked

Calculate service in detail

12/6/2012 4:47:54 AM
ASPRunnerPro General questions
A
adnankmk author

I want to calculate the service of the employees. I use the function given below and able to calculate the service in years only. I also want to calculate the months and days in detail. Can any body help me to calculate the service in detail.
var ctrlDate = Runner.getControl(pageid, 'Transfer_Date');

var service= Runner.getControl(pageid, 'Service');

now = new Date();

function func() {

var dateofbirth=new Date(ctrlDate.getValue());

var age=now.getFullYear()-dateofbirth.getFullYear();

if (now.getMonth()<dateofbirth.getMonth()) {

age=age-1;

}

service.setValue(age);

};
service.on('click', func);
Thanks in advance.

Sergey Kornilov admin 12/6/2012

Could you provide more details? What 'Calculate service in detail' means?

A
adnankmk author 12/6/2012



Could you provide more details? What 'Calculate service in detail' means?


Thanks for responding.
Service in detail means the detail in year, months and days. for example if the service of the employees is 10 years 2 months and 11 days the the function should calculate the years, months and days also. but the above functions calculate the years only.
Thanks.

Sergey Kornilov admin 12/7/2012

Sorry, still not clear how this applies to the sample code you have supplied.
Could you be more specific?

A
adnankmk author 12/8/2012



Sorry, still not clear how this applies to the sample code you have supplied.
Could you be more specific?


the sample code applies events as onpageload(); functions. the sample code returns the values in years. when the page is loaded.

Sergey Kornilov admin 12/9/2012

Still not clear. Doesn't make much sense without seeing your form.
I recommend to post your application to Demo Account and open a ticket at http://support.xlinesoft.com sending your Demo Account URL. 'Demo Account' button can be found on the last screen in the program.