How to get Day name from date in Siebel eScript

Below function in Siebel eScipt will return the Day from the date.

Input:

CurrentDate: 08/10/2021 (MM/DD/YYYY)

Result:

Tuesday


var dayName, CurrentDate;

dayName = GetWeekDay(CurrentDate); 

-- -- GetWeekDay -- --

function GetWeekDay(currentDate)
{
    var weekDay, sDate, theYear, sDay = "", i = 0;
    weekDay = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
    sDate = new Date(currentDate);
    theYear = sDate.getFullYear()
    
    while (i < sDate.getDay())
    {
        i++;
        sDay = weekDay[i];
    }
    return(sDay);
}

← Back to Home

Comments

Post a Comment