RE: How to get value of date only field . (11/1/2022)
Hi Diksha,
Please try this function,
function getDateField(e){
// Get the Form Context
var formContext = e.getFormContext();
// Get the value of the Opportunity Est. Close Date
var date = formContext.getAttribute("estimatedclosedate").getValue();
if (date != null) {
var day = date.getDate();
var month = date.getMonth();
var year = date.getFullYear();
month++;
// Add leading 0's to single digit days and months
if (day < 10) {day = "0" + day;}
if (month < 10) {month = "0" + month;}
// Create a variable with the formatted date as MM/DD/YYYY
var formattedDate = month + "/" + day + "/" + year;
// Create a variable with the formatted date as DD/MM/YYYY
//var formattedDate = date + "/" + month + "/" + year;
}
}
Please mark the answer as verified if that's resolve your problem.