Have you ever encounter problems such as request for date format to be MMYY or YYMM?
Below i added JavaScript to cater for the problem.
function GenerateYYMM() {
var newvalueMonth;
var valueMonth = new Date().getMonth() + 1;
var valueYear = new Date().getFullYear();
//get the last 2 character of year
var valueYearLength = valueYear.toString().length;
var YearToString = valueYear.toString();
var last_char=YearToString.charAt(valueYearLength-1);
var Before_last_char=YearToString.charAt(valueYearLength-2);
var LastTwoYearChar = Before_last_char + last_char;
//get the last 2 character of month with length 2
var valueMonthLength = valueMonth.toString().length;
if (valueMonthLength != 2) {newvalueMonth = "0" + valueMonth.toString();}
else {newvalueMonth = valueMonth.toString();}
var NewYYMM = LastTwoYearChar + newvalueMonth;
return NewYYMM;
}
*Note based on today date. U can use this on any date field too.
CRM 2011 Get Last Two Character/ Last Character
Posted by Unknown at 1/02/2013 12:03:00 pm
Labels: CRM 2011, Javascript
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment