B
Bryan Hughes
Hello,
I have a Date Field that has a default date in it.
How do you extract the month and day from the date in jscript?
Here is the code:
function XDocument::OnLoad(eventObj)
{
// Write your code here
var CurrentDate = new Date(); //Create Date object with today's date
var y = CurrentDate.getFullYear(); //Get Current Year
var d = CurrentDate.getDate(); //Get Current Day
var m = CurrentDate.getMonth() + 1; //Get Current Month
var StartDate = XDocument.DOM.selectSingleNode("//my:myDOH");
var sdM = "7"
var sdD = "1";
var EvalDate1 = XDocument.DOM.selectSingleNode("//my:myEPStartDate");
var epsdY = y - 1; //Eval Start Date Year
if ( EvalDate1.text =="")
{
EvalDate1.text = (sdM + "/" + sdD + "/" + epsdY);
}
var EvalDate2 = XDocument.DOM.selectSingleNode("//my:myEPEndDate");
if (EvalDate2.text == "")
{
EvalDate2.text = (sdM + "/" + sdD + "/" + y);
}
}
I am trying to extract the Date from the myDOH field then get the month and
date from that date instead of writing it in code every time.
-TFTH
Bryan
I have a Date Field that has a default date in it.
How do you extract the month and day from the date in jscript?
Here is the code:
function XDocument::OnLoad(eventObj)
{
// Write your code here
var CurrentDate = new Date(); //Create Date object with today's date
var y = CurrentDate.getFullYear(); //Get Current Year
var d = CurrentDate.getDate(); //Get Current Day
var m = CurrentDate.getMonth() + 1; //Get Current Month
var StartDate = XDocument.DOM.selectSingleNode("//my:myDOH");
var sdM = "7"
var sdD = "1";
var EvalDate1 = XDocument.DOM.selectSingleNode("//my:myEPStartDate");
var epsdY = y - 1; //Eval Start Date Year
if ( EvalDate1.text =="")
{
EvalDate1.text = (sdM + "/" + sdD + "/" + epsdY);
}
var EvalDate2 = XDocument.DOM.selectSingleNode("//my:myEPEndDate");
if (EvalDate2.text == "")
{
EvalDate2.text = (sdM + "/" + sdD + "/" + y);
}
}
I am trying to extract the Date from the myDOH field then get the month and
date from that date instead of writing it in code every time.
-TFTH
Bryan