CRM 2011 Date control
-
Wednesday, May 16, 2012 8:46 AM
Hi
I have date control in CRM nd one Numeric field control.
if date is 10/10/2012
and Numberic field values is 10
I want to add 10/10/2022 means i have to add the values to years..
How can i do it
Rammohan
All Replies
-
Wednesday, May 16, 2012 9:42 AMModerator
Try to use following code:
var d = Xrm.Page.getAttribute("your date time field").getValue(); var delta = Xrm.Page.getAttribute("your integer field").getValue(); if (d != null && delta != null) { d.setFullYear(d.getFullYear() + delta); Xrm.Page.getAttribute("your date time field").setValue(d); }
Microsoft CRM Freelancer
My blog (english)
Мой блог (русскоязычный)
- Proposed As Answer by MubasherSharif Wednesday, May 16, 2012 10:36 AM
- Marked As Answer by Andrii ButenkoMVP, Moderator Thursday, May 17, 2012 7:57 AM
- Unmarked As Answer by Rammohan Ammiti Wednesday, May 23, 2012 3:58 AM
- Unproposed As Answer by Rammohan Ammiti Wednesday, May 23, 2012 3:59 AM
- Proposed As Answer by Andrii ButenkoMVP, Moderator Wednesday, May 23, 2012 4:15 AM
-
Wednesday, May 23, 2012 4:02 AM
Hi
d.setFullYear(d.getFullYear() + delta);
instead of SetFullYear SetFullDays funtion is it work?
I want to add the days please tell me the method..
SetFullDays is not working for me
Rammohan
-
Wednesday, May 23, 2012 4:13 AM
Rammohan,
To set the day, you would need d.setDate(day);
To set the month, you can call d.setMonth(month - 1); // Need to put -1 to get the correct month
I hope this helps. If my response answered your question, please mark the response as an answer and also vote as helpful.
Dimaz Pramudya - CRM Developer - CSG (Melbourne) www.xrmbits.com http://twitter.com/xrmbits
- Proposed As Answer by Dimaz Pramudya (www.xrmbits.com) Wednesday, May 23, 2012 4:13 AM
- Edited by Dimaz Pramudya (www.xrmbits.com) Wednesday, May 23, 2012 4:21 AM
-
Wednesday, May 23, 2012 4:14 AMModerator
Guessing is wrong approach. Have you tried search engines? I tried and I found an answer in 1 minute. Here is description of Date object in JavaScript - http://www.w3schools.com/jsref/jsref_obj_date.aspHi
d.setFullYear(d.getFullYear() + delta);
instead of SetFullYear SetFullDays funtion is it work?
I want to add the days please tell me the method..
SetFullDays is not working for me
Rammohan
Microsoft CRM Freelancer
My blog (english)
Мой блог (русскоязычный)
- Proposed As Answer by Andrii ButenkoMVP, Moderator Wednesday, May 23, 2012 4:15 AM
- Unproposed As Answer by Rammohan Ammiti Thursday, May 24, 2012 7:07 AM
- Marked As Answer by Rammohan Ammiti Thursday, May 24, 2012 7:08 AM
-
Wednesday, May 23, 2012 4:22 AM
Andrii,
Sorry typo there. I've updated the original post.
Cheers.
Dimaz Pramudya - CRM Developer - CSG (Melbourne) www.xrmbits.com http://twitter.com/xrmbits
- Marked As Answer by Rammohan Ammiti Thursday, May 24, 2012 7:08 AM