我知道这是使用JavaScript库完成的。目前,我已经找到了CRM 2011年唯一的例子包括计算年龄年才使用此代码:如何根据出生日期在Microsoft CRM 2011中计算年龄和年份
function CalcAge()
{
var now = new Date(); //Todays Date
var birthday = Xrm.Page.getAttribute("birthdate").getValue(); //Get the Date of Birth value
var diff = now.getMonth() - birthday.getMonth(); //Check to see if Birthday has already passed
if (diff > -1) //If Birthday has already occurred
{
var bd1 = now.getFullYear() - birthday.getFullYear();
//set the age attribute
Xrm.Page.getAttribute("frc_age").setValue(bd1.toString());
}
else //If Birthday has not already occurred
{
var bd2 = now.getFullYear() - birthday.getFullYear() - 1;
Xrm.Page.getAttribute("frc_age").setValue(bd2.toString());
}
}
我需要实现类似的功能也占个月的帮助。
- 谢谢你
为一个月,你的意思,例如:“23.年7个月大“? –
这是正确的。 –