Thursday, June 12, 2014

JS Date, Add Month and Format with DatePicker

$('[id*=fvReleaseGroup_release_id] option:selected').text()
"March-2010"
$.datepicker.formatDate("mm/dd/yy", new Date(this))
"NaN/NaN/NaN"
$.datepicker.formatDate("mm/dd/yy", new Date("10/11/2009"))
"10/11/2009"
$.datepicker.formatDate("mm/dd/yy", new Date("March 1, 2009"))
"03/01/2009"
$.datepicker.formatDate("mm/dd/yy", new Date("March 1 2009"))
"03/01/2009"
$('[id*=fvReleaseGroup_release_id] option:selected').text().split("-").length
2
$('[id*=fvReleaseGroup_release_id] option:selected').text().split("-")[0]
"March"
$('[id*=fvReleaseGroup_release_id] option:selected').text().split("-")[1]
"2010"
$.datepicker.formatDate("mm/dd/yy", new Date("March-2010"))
"03/01/2010"
$.datepicker.formatDate("mm/dd/yy", new Date("March 2010"))
"03/01/2010"
var dt = new Date($('[id*=fvReleaseGroup_release_id] option:selected').text())
undefined
var newdt = dt.setMonth(d.getMonth() + 2);
ReferenceError: d is not defined
var newdt = dt.setMonth(dt.getMonth() + 2);
undefined
$.datepicker.formatDate("mm/dd/yy", newdt)
TypeError: undefined is not a function
$.datepicker.formatDate("mm/dd/yy", new Date("March 2010"))
"03/01/2010"
$.datepicker.formatDate("mm/dd/yy", new Date($('[id*=fvReleaseGroup_release_id] option:selected').text()))
"03/01/2010"
$.datepicker.formatDate("mm/dd/yy", new Date($('[id*=fvReleaseGroup_release_id] option:selected').text()).addMonths(2))
TypeError: undefined is not a function
$.datepicker.formatDate("mm/dd/yy", new Date($('[id*=fvReleaseGroup_release_id] option:selected').text()))
"03/01/2010"

var dt = new Date($('[id*=fvReleaseGroup_release_id] option:selected').text()); dt.toString();
"Mon Mar 01 2010 00:00:00 GMT-0500 (Eastern Standard Time)"
var dt = new Date($('[id*=fvReleaseGroup_release_id] option:selected').text()); dt.setMonth(dt.getMonth() + 2).toString();
"1272686400000"
var dt = new Date($('[id*=fvReleaseGroup_release_id] option:selected').text()); var newdt = dt.setMonth(dt.getMonth() + 2).toString();
undefined
var dt = new Date($('[id*=fvReleaseGroup_release_id] option:selected').text()); var newdt = dt.setMonth(dt.getMonth() + 2); newdt.toString();
"1272686400000"
var dt = new Date($('[id*=fvReleaseGroup_release_id] option:selected').text()); var newdt = dt.setMonth(dt.getMonth() + 2); newdt = new Date(newdt); $.datepicker.formatDate("mm/dd/yy",newdt);
"05/01/2010"

var dt = new Date($('[id*=fvReleaseGroup_release_id] option:selected').text()); var newdt = dt.setMonth(dt.getMonth() + 2); newdt = new Date(newdt); $.datepicker.formatDate("mm/dd/yy",newdt);

No comments:

Post a Comment