<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Need to Get the day based on entered date &amp;amp; time in Developer forum</title>
    <link>https://www.servicenow.com/community/developer-forum/need-to-get-the-day-based-on-entered-date-amp-time/m-p/3411064#M1234216</link>
    <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/453945"&gt;@is_12&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;try this and it will take care of any date/time format&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }

    // Parse string to milliseconds
    var dateMS = getDateFromFormat(newValue, g_user_date_time_format);
    var newDT = new Date();
    newDT.setTime(dateMS);

    // Example: Add 3 months
    newDT.setMonth(newDT.getMonth() + 3);

    // If you want 6 or 12 months, just change the +3:
    // newDT.setMonth(newDT.getMonth() + 6); // For 6 months
    // newDT.setMonth(newDT.getMonth() + 12); // For 12 months

    var val = formatDate(newDT, g_user_date_time_format);
    alert(val);
}
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;STRONG&gt;Output:I added 3 months, enhance further&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AnkurBawiskar_1-1761291386161.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/478611i0BCBAB52BB8E9713/image-size/medium?v=v2&amp;amp;px=400" alt="AnkurBawiskar_1-1761291386161.png" title="AnkurBawiskar_1-1761291386161.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":light_bulb:"&gt;💡&lt;/span&gt; If my response helped, please mark it as correct &lt;span class="lia-unicode-emoji" title=":white_heavy_check_mark:"&gt;✅&lt;/span&gt; and close the thread &lt;span class="lia-unicode-emoji" title=":locked:"&gt;🔒&lt;/span&gt;— this helps future readers find the solution faster! &lt;span class="lia-unicode-emoji" title=":folded_hands:"&gt;🙏&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 24 Oct 2025 07:36:54 GMT</pubDate>
    <dc:creator>Ankur Bawiskar</dc:creator>
    <dc:date>2025-10-24T07:36:54Z</dc:date>
    <item>
      <title>Need to Get the day based on entered date &amp; time</title>
      <link>https://www.servicenow.com/community/developer-forum/need-to-get-the-day-based-on-entered-date-amp-time/m-p/3410954#M1234193</link>
      <description>&lt;P&gt;Hi Community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;On the Catalog form I have field start &amp;amp; end date.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Based on the start date need to get the day&lt;/P&gt;&lt;P&gt;&amp;nbsp;And also based on the start date, need to get the next 3months &amp;amp; 6months &amp;amp; 12months date&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone help me with this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Oct 2025 06:46:37 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/need-to-get-the-day-based-on-entered-date-amp-time/m-p/3410954#M1234193</guid>
      <dc:creator>is_12</dc:creator>
      <dc:date>2025-10-23T06:46:37Z</dc:date>
    </item>
    <item>
      <title>Re: Need to Get the day based on entered date &amp; time</title>
      <link>https://www.servicenow.com/community/developer-forum/need-to-get-the-day-based-on-entered-date-amp-time/m-p/3410963#M1234194</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/453945"&gt;@is_12&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;something like this in client script will help you&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;function onChange(control, oldValue, newValue, isLoading) {
  if (isLoading || newValue == '') {
    return;
  }

  // Parse start date as JS date object
  var startDate = new Date(newValue);

  // Get day of the week (e.g., "Sunday", "Monday")
  var days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
  var dayName = days[startDate.getUTCDay()];
  g_form.setValue('u_day_of_week', dayName); // Replace 'u_day_of_week' with the field you want

  // Calculate Next 3, 6, and 12 Months Dates
  function addMonths(date, months) {
    var d = new Date(date);
    var day = d.getDate();
    d.setMonth(d.getMonth() + months);

    // Adjust if date overflows (e.g., April 31)
    if (d.getDate() &amp;lt; day) {
      d.setDate(0);
    }
    return d;
  }

  var date3 = addMonths(startDate, 3);
  var date6 = addMonths(startDate, 6);
  var date12 = addMonths(startDate, 12);

  // Format as yyyy-MM-dd (ServiceNow Date field format)
  function formatSNDate(d) {
    var mm = String(d.getMonth() + 1).padStart(2, '0');
    var dd = String(d.getDate()).padStart(2, '0');
    var yyyy = d.getFullYear();
    return yyyy + '-' + mm + '-' + dd;
  }

  g_form.setValue('u_next_3_months', formatSNDate(date3));   // Replace with your catalog variable
  g_form.setValue('u_next_6_months', formatSNDate(date6));   // Replace with your catalog variable
  g_form.setValue('u_next_12_months', formatSNDate(date12)); // Replace with your catalog variable
}
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":light_bulb:"&gt;💡&lt;/span&gt; If my response helped, please mark it as correct &lt;span class="lia-unicode-emoji" title=":white_heavy_check_mark:"&gt;✅&lt;/span&gt; and close the thread &lt;span class="lia-unicode-emoji" title=":locked:"&gt;🔒&lt;/span&gt;— this helps future readers find the solution faster! &lt;span class="lia-unicode-emoji" title=":folded_hands:"&gt;🙏&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Oct 2025 06:58:49 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/need-to-get-the-day-based-on-entered-date-amp-time/m-p/3410963#M1234194</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2025-10-23T06:58:49Z</dc:date>
    </item>
    <item>
      <title>Re: Need to Get the day based on entered date &amp; time</title>
      <link>https://www.servicenow.com/community/developer-forum/need-to-get-the-day-based-on-entered-date-amp-time/m-p/3410998#M1234202</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/453945"&gt;@is_12&lt;/a&gt;&amp;nbsp;, Add below code in your on change script on start date field.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || !newValue) return;
    var startDate = new Date(newValue);
    var days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
    var dayName = days[startDate.getDay()];
    function addMonths(date, months) {
        var d = new Date(date);
        d.setMonth(d.getMonth() + months);
        return (
            d.getFullYear() +
            '-' +
            String(d.getMonth() + 1).padStart(2, '0') +
            '-' +
            String(d.getDate()).padStart(2, '0')
        );
    }
    var next3 = addMonths(startDate, 3);
    var next6 = addMonths(startDate, 6);
    var next12 = addMonths(startDate, 12);
    g_form.setValue('u_day_name', dayName);
    g_form.setValue('u_3_months_date', next3);
    g_form.setValue('u_6_months_date', next6);
    g_form.setValue('u_12_months_date', next12);
}&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 23 Oct 2025 07:45:03 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/need-to-get-the-day-based-on-entered-date-amp-time/m-p/3410998#M1234202</guid>
      <dc:creator>miftikhar20</dc:creator>
      <dc:date>2025-10-23T07:45:03Z</dc:date>
    </item>
    <item>
      <title>Re: Need to Get the day based on entered date &amp; time</title>
      <link>https://www.servicenow.com/community/developer-forum/need-to-get-the-day-based-on-entered-date-amp-time/m-p/3411028#M1234208</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/265966"&gt;@Ankur Bawiskar&lt;/a&gt;&amp;nbsp;&amp;amp;&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/260618"&gt;@miftikhar20&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please refactor the code to support all the different date formats that ServiceNow provides as each user could change their date / time formats and if its not the OOB yyyy-MM-dd format then both the scripts will break as new Date() expects a specific format&lt;/P&gt;</description>
      <pubDate>Thu, 23 Oct 2025 08:10:06 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/need-to-get-the-day-based-on-entered-date-amp-time/m-p/3411028#M1234208</guid>
      <dc:creator>Simon Christens</dc:creator>
      <dc:date>2025-10-23T08:10:06Z</dc:date>
    </item>
    <item>
      <title>Re: Need to Get the day based on entered date &amp; time</title>
      <link>https://www.servicenow.com/community/developer-forum/need-to-get-the-day-based-on-entered-date-amp-time/m-p/3411046#M1234211</link>
      <description>&lt;P&gt;Hi there&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/453945"&gt;@is_12&lt;/a&gt;&amp;nbsp;, Here is the script it should work for all date and time formats regardless of any region.&lt;/P&gt;&lt;P&gt;Script -&amp;nbsp;&lt;/P&gt;&lt;P&gt;function onChange(control, oldValue, newValue, isLoading) {&lt;BR /&gt;if (isLoading || newValue == '') {&lt;BR /&gt;return;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;var gdt = new GlideDateTime();&lt;BR /&gt;gdt.setDisplayValue(newValue);&lt;/P&gt;&lt;P&gt;var dayOfWeek = getDayName(gdt);&lt;/P&gt;&lt;P&gt;var date3 = new GlideDateTime(gdt);&lt;BR /&gt;date3.addMonthsLocalTime(3);&lt;/P&gt;&lt;P&gt;var date6 = new GlideDateTime(gdt);&lt;BR /&gt;date6.addMonthsLocalTime(6);&lt;/P&gt;&lt;P&gt;var date12 = new GlideDateTime(gdt);&lt;BR /&gt;date12.addMonthsLocalTime(12);&lt;/P&gt;&lt;P&gt;g_form.setValue('day_of_week', dayOfWeek);&lt;BR /&gt;g_form.setValue('next_3_months', date3.getDisplayValue());&lt;BR /&gt;g_form.setValue('next_6_months', date6.getDisplayValue());&lt;BR /&gt;g_form.setValue('next_12_months', date12.getDisplayValue());&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;function getDayName(gdt) {&lt;BR /&gt;var jsDate = new Date(gdt.getNumericValue());&lt;BR /&gt;var days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];&lt;BR /&gt;return days[jsDate.getDay()];&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this answer helps you in any way make sure to Mark this as accepted solution and give a thumbs up this will also benefit others as well.&lt;BR /&gt;Regards.&lt;BR /&gt;Saurabh V.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Oct 2025 08:36:52 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/need-to-get-the-day-based-on-entered-date-amp-time/m-p/3411046#M1234211</guid>
      <dc:creator>svirkar420</dc:creator>
      <dc:date>2025-10-23T08:36:52Z</dc:date>
    </item>
    <item>
      <title>Re: Need to Get the day based on entered date &amp; time</title>
      <link>https://www.servicenow.com/community/developer-forum/need-to-get-the-day-based-on-entered-date-amp-time/m-p/3411048#M1234212</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/198604"&gt;@Simon Christens&lt;/a&gt;&amp;nbsp;, Try this code this should work for all regions and time formats.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Script:&amp;nbsp;&lt;/P&gt;&lt;P&gt;function onChange(control, oldValue, newValue, isLoading) {&lt;BR /&gt;if (isLoading || newValue == '') {&lt;BR /&gt;return;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;var gdt = new GlideDateTime();&lt;BR /&gt;gdt.setDisplayValue(newValue);&lt;/P&gt;&lt;P&gt;var dayOfWeek = getDayName(gdt);&lt;/P&gt;&lt;P&gt;var date3 = new GlideDateTime(gdt);&lt;BR /&gt;date3.addMonthsLocalTime(3);&lt;/P&gt;&lt;P&gt;var date6 = new GlideDateTime(gdt);&lt;BR /&gt;date6.addMonthsLocalTime(6);&lt;/P&gt;&lt;P&gt;var date12 = new GlideDateTime(gdt);&lt;BR /&gt;date12.addMonthsLocalTime(12);&lt;/P&gt;&lt;P&gt;g_form.setValue('day_of_week', dayOfWeek);&lt;BR /&gt;g_form.setValue('next_3_months', date3.getDisplayValue());&lt;BR /&gt;g_form.setValue('next_6_months', date6.getDisplayValue());&lt;BR /&gt;g_form.setValue('next_12_months', date12.getDisplayValue());&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;function getDayName(gdt) {&lt;BR /&gt;var jsDate = new Date(gdt.getNumericValue());&lt;BR /&gt;var days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];&lt;BR /&gt;return days[jsDate.getDay()];&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this answer helps you in any way make sure to Mark this as accepted solution and give a thumbs up this will also benefit others as well.&lt;BR /&gt;Regards.&lt;BR /&gt;Saurabh V.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Oct 2025 08:36:16 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/need-to-get-the-day-based-on-entered-date-amp-time/m-p/3411048#M1234212</guid>
      <dc:creator>svirkar420</dc:creator>
      <dc:date>2025-10-23T08:36:16Z</dc:date>
    </item>
    <item>
      <title>Re: Need to Get the day based on entered date &amp; time</title>
      <link>https://www.servicenow.com/community/developer-forum/need-to-get-the-day-based-on-entered-date-amp-time/m-p/3411064#M1234216</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/453945"&gt;@is_12&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;try this and it will take care of any date/time format&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }

    // Parse string to milliseconds
    var dateMS = getDateFromFormat(newValue, g_user_date_time_format);
    var newDT = new Date();
    newDT.setTime(dateMS);

    // Example: Add 3 months
    newDT.setMonth(newDT.getMonth() + 3);

    // If you want 6 or 12 months, just change the +3:
    // newDT.setMonth(newDT.getMonth() + 6); // For 6 months
    // newDT.setMonth(newDT.getMonth() + 12); // For 12 months

    var val = formatDate(newDT, g_user_date_time_format);
    alert(val);
}
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;STRONG&gt;Output:I added 3 months, enhance further&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AnkurBawiskar_1-1761291386161.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/478611i0BCBAB52BB8E9713/image-size/medium?v=v2&amp;amp;px=400" alt="AnkurBawiskar_1-1761291386161.png" title="AnkurBawiskar_1-1761291386161.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":light_bulb:"&gt;💡&lt;/span&gt; If my response helped, please mark it as correct &lt;span class="lia-unicode-emoji" title=":white_heavy_check_mark:"&gt;✅&lt;/span&gt; and close the thread &lt;span class="lia-unicode-emoji" title=":locked:"&gt;🔒&lt;/span&gt;— this helps future readers find the solution faster! &lt;span class="lia-unicode-emoji" title=":folded_hands:"&gt;🙏&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Oct 2025 07:36:54 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/need-to-get-the-day-based-on-entered-date-amp-time/m-p/3411064#M1234216</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2025-10-24T07:36:54Z</dc:date>
    </item>
    <item>
      <title>Re: Need to Get the day based on entered date &amp; time</title>
      <link>https://www.servicenow.com/community/developer-forum/need-to-get-the-day-based-on-entered-date-amp-time/m-p/3411094#M1234218</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/707053"&gt;@svirkar420&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;are you sure the above script will work fine in client script?&lt;/P&gt;
&lt;P&gt;Could you please share a working example?&lt;/P&gt;</description>
      <pubDate>Thu, 23 Oct 2025 09:06:40 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/need-to-get-the-day-based-on-entered-date-amp-time/m-p/3411094#M1234218</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2025-10-23T09:06:40Z</dc:date>
    </item>
    <item>
      <title>Re: Need to Get the day based on entered date &amp; time</title>
      <link>https://www.servicenow.com/community/developer-forum/need-to-get-the-day-based-on-entered-date-amp-time/m-p/3411843#M1234349</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/453945"&gt;@is_12&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope you are doing good.&lt;/P&gt;
&lt;P&gt;Did my reply answer your question?&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":light_bulb:"&gt;💡&lt;/span&gt; If my response helped, please mark it as correct &lt;span class="lia-unicode-emoji" title=":white_heavy_check_mark:"&gt;✅&lt;/span&gt; and close the thread &lt;span class="lia-unicode-emoji" title=":locked:"&gt;🔒&lt;/span&gt;— this helps future readers find the solution faster! &lt;span class="lia-unicode-emoji" title=":folded_hands:"&gt;🙏&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Oct 2025 03:32:01 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/need-to-get-the-day-based-on-entered-date-amp-time/m-p/3411843#M1234349</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2025-10-24T03:32:01Z</dc:date>
    </item>
    <item>
      <title>Re: Need to Get the day based on entered date &amp; time</title>
      <link>https://www.servicenow.com/community/developer-forum/need-to-get-the-day-based-on-entered-date-amp-time/m-p/3411948#M1234362</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/265966"&gt;@Ankur Bawiskar&lt;/a&gt;&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/260618"&gt;@miftikhar20&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried to implement the &lt;SPAN&gt;based on the start date, need to get the next 3months &amp;amp; 6months &amp;amp; 12months date, but&amp;nbsp;&lt;/SPAN&gt;both of the code, which you guy's have given is getting the console javascript error on the portal.&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;function&lt;/SPAN&gt;&lt;SPAN&gt; addMonths(date, months) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; alert(&lt;/SPAN&gt;&lt;SPAN&gt;'Hello7'&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; d = &lt;/SPAN&gt;&lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;Date&lt;/SPAN&gt;&lt;SPAN&gt;(date);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; d.setMonth(d.getMonth() + months);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;return&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; d.getFullYear() +&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;'-'&lt;/SPAN&gt;&lt;SPAN&gt; +&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;String&lt;/SPAN&gt;&lt;SPAN&gt;(d.getMonth() + &lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;).padStart(&lt;/SPAN&gt;&lt;SPAN&gt;2&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;'0'&lt;/SPAN&gt;&lt;SPAN&gt;) +&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;'-'&lt;/SPAN&gt;&lt;SPAN&gt; +&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;String&lt;/SPAN&gt;&lt;SPAN&gt;(d.getDate()).padStart(&lt;/SPAN&gt;&lt;SPAN&gt;2&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;'0'&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; );&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; next3 = addMonths(startDate, &lt;/SPAN&gt;&lt;SPAN&gt;3&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; next6 = addMonths(startDate, &lt;/SPAN&gt;&lt;SPAN&gt;6&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; next12 = addMonths(startDate, &lt;/SPAN&gt;&lt;SPAN&gt;12&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;//g_form.setValue('u_day_name', dayName);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; g_form.setValue(&lt;/SPAN&gt;&lt;SPAN&gt;'day_3'&lt;/SPAN&gt;&lt;SPAN&gt;, next3);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; alert(&lt;/SPAN&gt;&lt;SPAN&gt;'Hello22'&lt;/SPAN&gt;&lt;SPAN&gt;+next3);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; g_form.setValue(&lt;/SPAN&gt;&lt;SPAN&gt;'day_6'&lt;/SPAN&gt;&lt;SPAN&gt;, next6);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; alert(&lt;/SPAN&gt;&lt;SPAN&gt;'Hello24'&lt;/SPAN&gt;&lt;SPAN&gt;+next6);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; g_form.setValue(&lt;/SPAN&gt;&lt;SPAN&gt;'day_12'&lt;/SPAN&gt;&lt;SPAN&gt;, next12);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; alert(&lt;/SPAN&gt;&lt;SPAN&gt;'Hello26'&lt;/SPAN&gt;&lt;SPAN&gt;+next12);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;only first alert I'm getting post that I'm getting the error&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 24 Oct 2025 07:23:09 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/need-to-get-the-day-based-on-entered-date-amp-time/m-p/3411948#M1234362</guid>
      <dc:creator>is_12</dc:creator>
      <dc:date>2025-10-24T07:23:09Z</dc:date>
    </item>
    <item>
      <title>Re: Need to Get the day based on entered date &amp; time</title>
      <link>https://www.servicenow.com/community/developer-forum/need-to-get-the-day-based-on-entered-date-amp-time/m-p/3411958#M1234366</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/453945"&gt;@is_12&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I gave another easy code below with output.&lt;/P&gt;
&lt;P&gt;Did you check that?&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AnkurBawiskar_2-1761291450066.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/478612iF5D9F377732B5BE1/image-size/medium?v=v2&amp;amp;px=400" alt="AnkurBawiskar_2-1761291450066.png" title="AnkurBawiskar_2-1761291450066.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":light_bulb:"&gt;💡&lt;/span&gt; If my response helped, please mark it as correct &lt;span class="lia-unicode-emoji" title=":white_heavy_check_mark:"&gt;✅&lt;/span&gt; and close the thread &lt;span class="lia-unicode-emoji" title=":locked:"&gt;🔒&lt;/span&gt;— this helps future readers find the solution faster! &lt;span class="lia-unicode-emoji" title=":folded_hands:"&gt;🙏&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Oct 2025 07:37:42 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/need-to-get-the-day-based-on-entered-date-amp-time/m-p/3411958#M1234366</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2025-10-24T07:37:42Z</dc:date>
    </item>
    <item>
      <title>Re: Need to Get the day based on entered date &amp; time</title>
      <link>https://www.servicenow.com/community/developer-forum/need-to-get-the-day-based-on-entered-date-amp-time/m-p/3411977#M1234371</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/265966"&gt;@Ankur Bawiskar&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;yes I have tried but it is getting set to today's date only&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="is_12_0-1761291675883.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/478613i807A13F00FFD2CCF/image-size/medium?v=v2&amp;amp;px=400" alt="is_12_0-1761291675883.png" title="is_12_0-1761291675883.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Oct 2025 07:41:31 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/need-to-get-the-day-based-on-entered-date-amp-time/m-p/3411977#M1234371</guid>
      <dc:creator>is_12</dc:creator>
      <dc:date>2025-10-24T07:41:31Z</dc:date>
    </item>
    <item>
      <title>Re: Need to Get the day based on entered date &amp; time</title>
      <link>https://www.servicenow.com/community/developer-forum/need-to-get-the-day-based-on-entered-date-amp-time/m-p/3411982#M1234373</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/265966"&gt;@Ankur Bawiskar&lt;/a&gt;&amp;nbsp;But instead I need 3months or 6months date from today&lt;/P&gt;</description>
      <pubDate>Fri, 24 Oct 2025 07:43:05 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/need-to-get-the-day-based-on-entered-date-amp-time/m-p/3411982#M1234373</guid>
      <dc:creator>is_12</dc:creator>
      <dc:date>2025-10-24T07:43:05Z</dc:date>
    </item>
    <item>
      <title>Re: Need to Get the day based on entered date &amp; time</title>
      <link>https://www.servicenow.com/community/developer-forum/need-to-get-the-day-based-on-entered-date-amp-time/m-p/3411984#M1234375</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/453945"&gt;@is_12&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I just now updated the script, are you using the correct one?&lt;/P&gt;
&lt;P&gt;share your client script and is it marked as UI Type - ALL&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":light_bulb:"&gt;💡&lt;/span&gt; If my response helped, please mark it as correct &lt;span class="lia-unicode-emoji" title=":white_heavy_check_mark:"&gt;✅&lt;/span&gt; and close the thread &lt;span class="lia-unicode-emoji" title=":locked:"&gt;🔒&lt;/span&gt;— this helps future readers find the solution faster! &lt;span class="lia-unicode-emoji" title=":folded_hands:"&gt;🙏&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Oct 2025 07:44:39 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/need-to-get-the-day-based-on-entered-date-amp-time/m-p/3411984#M1234375</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2025-10-24T07:44:39Z</dc:date>
    </item>
    <item>
      <title>Re: Need to Get the day based on entered date &amp; time</title>
      <link>https://www.servicenow.com/community/developer-forum/need-to-get-the-day-based-on-entered-date-amp-time/m-p/3412023#M1234393</link>
      <description>&lt;P&gt;ServiceNow – Catalog item: derive Day of Week and +3/+6/+12 month dates from Start Date&lt;/P&gt;&lt;P&gt;What you want&lt;BR /&gt;- On a catalog form, when the user selects Start Date:&lt;BR /&gt;1) Show the Day of Week for that date&lt;BR /&gt;2) Auto-populate dates at +3 months, +6 months, and +12 months&lt;/P&gt;&lt;P&gt;Approach (robust &amp;amp; timezone-safe)&lt;BR /&gt;Use an onChange Catalog Client Script that calls a Client‑callable Script Include. The server computes dates with GlideDateTime (handles locale/DST correctly), and returns a small JSON payload for the client to set variables.&lt;/P&gt;&lt;P&gt;Variables (example names)&lt;BR /&gt;- start_date (Type: Date)&lt;BR /&gt;- day_of_week (Type: Single Line Text, Read‑only = true)&lt;BR /&gt;- date_plus_3m (Type: Date, Read‑only = true)&lt;BR /&gt;- date_plus_6m (Type: Date, Read‑only = true)&lt;BR /&gt;- date_plus_12m (Type: Date, Read‑only = true)&lt;/P&gt;&lt;P&gt;1) Script Include (Client callable)&lt;BR /&gt;----------------------------------&lt;BR /&gt;Name: DateCalcAjax (global or your scope)&lt;BR /&gt;Client callable: ✔&lt;/P&gt;&lt;P&gt;/** Script Include **/&lt;BR /&gt;var DateCalcAjax = Class.create();&lt;BR /&gt;DateCalcAjax.prototype = Object.extendsObject(AbstractAjaxProcessor, {&lt;BR /&gt;getOffsets: function() {&lt;BR /&gt;var start = this.getParameter('sysparm_start'); // expects display or ISO date (yyyy-MM-dd)&lt;BR /&gt;if (!start) return '{}';&lt;/P&gt;&lt;P&gt;// Initialize&lt;BR /&gt;var gdt = new GlideDateTime();&lt;BR /&gt;// If start is just a date (no time), set to local 00:00&lt;BR /&gt;gdt.setDisplayValue(start + ' 00:00:00');&lt;/P&gt;&lt;P&gt;// Day of week (1=Sunday .. 7=Saturday for getDayOfWeekLocalTime())&lt;BR /&gt;var dowNum = gdt.getDayOfWeekLocalTime ? gdt.getDayOfWeekLocalTime() : gdt.getDayOfWeek(); // fallback&lt;BR /&gt;var names = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];&lt;BR /&gt;// Map 1..7 → 0..6&lt;BR /&gt;var dowName = names[(dowNum - 1 + 7) % 7];&lt;/P&gt;&lt;P&gt;function addMonthsClone(srcGdt, n) {&lt;BR /&gt;var copy = new GlideDateTime(srcGdt);&lt;BR /&gt;copy.addMonthsLocalTime(n);&lt;BR /&gt;return copy.getDate().getValue(); // yyyy-MM-dd&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;var d3 = addMonthsClone(gdt, 3);&lt;BR /&gt;var d6 = addMonthsClone(gdt, 6);&lt;BR /&gt;var d12 = addMonthsClone(gdt, 12);&lt;/P&gt;&lt;P&gt;var payload = {&lt;BR /&gt;day_of_week: dowName,&lt;BR /&gt;date_plus_3m: d3,&lt;BR /&gt;date_plus_6m: d6,&lt;BR /&gt;date_plus_12m: d12&lt;BR /&gt;};&lt;BR /&gt;return new global.JSON().encode(payload);&lt;BR /&gt;},&lt;/P&gt;&lt;P&gt;type: 'DateCalcAjax'&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;2) Catalog Client Script (onChange on start_date)&lt;BR /&gt;-------------------------------------------------&lt;BR /&gt;Type: onChange&lt;BR /&gt;Applies to: Catalog Client Script&lt;BR /&gt;UI Type: All (Desktop, Mobile, Service Portal)&lt;BR /&gt;Variable name: start_date&lt;BR /&gt;Script:&lt;BR /&gt;function onChange(control, oldValue, newValue, isLoading, isTemplate) {&lt;BR /&gt;if (isLoading) return;&lt;BR /&gt;if (!newValue) {&lt;BR /&gt;g_form.clearValue('day_of_week');&lt;BR /&gt;g_form.clearValue('date_plus_3m');&lt;BR /&gt;g_form.clearValue('date_plus_6m');&lt;BR /&gt;g_form.clearValue('date_plus_12m');&lt;BR /&gt;return;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;var ga = new GlideAjax('DateCalcAjax');&lt;BR /&gt;ga.addParam('sysparm_name', 'getOffsets');&lt;BR /&gt;ga.addParam('sysparm_start', newValue); // yyyy-MM-dd&lt;BR /&gt;ga.getXMLAnswer(function(ans) {&lt;BR /&gt;try {&lt;BR /&gt;var data = JSON.parse(ans || '{}');&lt;BR /&gt;if (data.day_of_week) g_form.setValue('day_of_week', data.day_of_week);&lt;BR /&gt;if (data.date_plus_3m) g_form.setValue('date_plus_3m', data.date_plus_3m);&lt;BR /&gt;if (data.date_plus_6m) g_form.setValue('date_plus_6m', data.date_plus_6m);&lt;BR /&gt;if (data.date_plus_12m) g_form.setValue('date_plus_12m', data.date_plus_12m);&lt;BR /&gt;} catch (e) {&lt;BR /&gt;console.log('Date calc parse error', e);&lt;BR /&gt;}&lt;BR /&gt;});&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;Notes &amp;amp; Tips&lt;BR /&gt;------------&lt;BR /&gt;- Ensure your variable names in the script (day_of_week, date_plus_3m, etc.) match the actual variable “Name” (not the label).&lt;BR /&gt;- Date variable values should be in yyyy-MM-dd format; the Script Include already returns that.&lt;BR /&gt;- If you also need to set an End Date, add logic in the Script Include to compute it and add to payload.&lt;BR /&gt;- This works in Classic UI, Service Portal, and Workspace.&lt;BR /&gt;- If you prefer a pure client approach (no server call), you can compute with JavaScript Date(), but you must handle timezones and month-end rollovers yourself. Example snippet below.&lt;/P&gt;&lt;P&gt;Pure client (optional alternative)&lt;BR /&gt;----------------------------------&lt;BR /&gt;function addMonthsYMD(ymd, months) {&lt;BR /&gt;// ymd: 'yyyy-MM-dd'&lt;BR /&gt;var parts = ymd.split('-');&lt;BR /&gt;var y = parseInt(parts[0],10), m = parseInt(parts[1],10)-1, d = parseInt(parts[2],10);&lt;BR /&gt;var dt = new Date(Date.UTC(y, m, d));&lt;BR /&gt;dt.setUTCMonth(dt.getUTCMonth() + months);&lt;BR /&gt;var yyyy = dt.getUTCFullYear();&lt;BR /&gt;var mm = String(dt.getUTCMonth()+1).padStart(2,'0');&lt;BR /&gt;var dd = String(dt.getUTCDate()).padStart(2,'0');&lt;BR /&gt;return yyyy + '-' + mm + '-' + dd;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;function dayOfWeekName(ymd) {&lt;BR /&gt;var p = ymd.split('-');&lt;BR /&gt;var dt = new Date(Date.UTC(+p[0], +p[1]-1, +p[2]));&lt;BR /&gt;return ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'][dt.getUTCDay()];&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Oct 2025 08:06:33 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/need-to-get-the-day-based-on-entered-date-amp-time/m-p/3412023#M1234393</guid>
      <dc:creator>MaxMixali</dc:creator>
      <dc:date>2025-10-24T08:06:33Z</dc:date>
    </item>
    <item>
      <title>Re: Need to Get the day based on entered date &amp; time</title>
      <link>https://www.servicenow.com/community/developer-forum/need-to-get-the-day-based-on-entered-date-amp-time/m-p/3412362#M1234476</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/265966"&gt;@Ankur Bawiskar&lt;/a&gt;, Thanks for your solution,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is a small change instead of start date + 3months, based on selected "start date" we have day of month that is nothing but date based on that it should be +3 or +6&lt;/P&gt;&lt;P&gt;Below is the reference&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="is_12_0-1761308655015.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/478691iC87389BF1519ABDC/image-size/medium?v=v2&amp;amp;px=400" alt="is_12_0-1761308655015.png" title="is_12_0-1761308655015.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tried with this below script&amp;nbsp;&lt;/P&gt;&lt;P&gt;Client script&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; dateMS = getDateFromFormat(newValue, g_user_date_time_format);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; newDT = &lt;/SPAN&gt;&lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;Date&lt;/SPAN&gt;&lt;SPAN&gt;();&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; newDT.setTime(dateMS);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;//alert("8"+dateMS);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;// Example: Add 3 months&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; ga = &lt;/SPAN&gt;&lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;GlideAjax&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'BT_CSR_SSR_CatalogUtils'&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; ga.addParam(&lt;/SPAN&gt;&lt;SPAN&gt;'sysparm_name'&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;'calDate'&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; ga.addParam(&lt;/SPAN&gt;&lt;SPAN&gt;'sysparm_date'&lt;/SPAN&gt;&lt;SPAN&gt;, g_form.getValue(&lt;/SPAN&gt;&lt;SPAN&gt;'start_date'&lt;/SPAN&gt;&lt;SPAN&gt;));&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; ga.addParam(&lt;/SPAN&gt;&lt;SPAN&gt;'sysparm_dayofmonth'&lt;/SPAN&gt;&lt;SPAN&gt;,g_form.getValue(&lt;/SPAN&gt;&lt;SPAN&gt;'run_dayofmonth'&lt;/SPAN&gt;&lt;SPAN&gt;));&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; ga.getXML(check);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;function&lt;/SPAN&gt;&lt;SPAN&gt; check(response) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; answer = response.responseXML.documentElement.getAttribute(&lt;/SPAN&gt;&lt;SPAN&gt;"answer"&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; alert(&lt;/SPAN&gt;&lt;SPAN&gt;"22"&lt;/SPAN&gt;&lt;SPAN&gt;+answer);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; ansParsed = &lt;/SPAN&gt;&lt;SPAN&gt;JSON&lt;/SPAN&gt;&lt;SPAN&gt;.parse(answer);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; gg = g_form.setValue(&lt;/SPAN&gt;&lt;SPAN&gt;'day_1'&lt;/SPAN&gt;&lt;SPAN&gt;, ansParsed);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; monthly = g_form.getValue(&lt;/SPAN&gt;&lt;SPAN&gt;'select_month'&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; (monthly == &lt;/SPAN&gt;&lt;SPAN&gt;'Every Month'&lt;/SPAN&gt;&lt;SPAN&gt;) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; alert(&lt;/SPAN&gt;&lt;SPAN&gt;"12"&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; newDT.setMonth(newDT.getMonth() + &lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; val = formatDate(newDT, g_user_date_time_format);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; g_form.setValue(&lt;/SPAN&gt;&lt;SPAN&gt;'day_1'&lt;/SPAN&gt;&lt;SPAN&gt;, val);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; alert(&lt;/SPAN&gt;&lt;SPAN&gt;"Monthly"&lt;/SPAN&gt;&lt;SPAN&gt; + val);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;script include&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; calDate: &lt;/SPAN&gt;&lt;SPAN&gt;function&lt;/SPAN&gt;&lt;SPAN&gt;() {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; sdt = &lt;/SPAN&gt;&lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;GlideDateTime&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;this&lt;/SPAN&gt;&lt;SPAN&gt;.getParameter(&lt;/SPAN&gt;&lt;SPAN&gt;'sysparm_date'&lt;/SPAN&gt;&lt;SPAN&gt;));&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sdt.addDaysLocalTime(&lt;/SPAN&gt;&lt;SPAN&gt;this&lt;/SPAN&gt;&lt;SPAN&gt;.getParameter(&lt;/SPAN&gt;&lt;SPAN&gt;'sysparm_dayofmonth'&lt;/SPAN&gt;&lt;SPAN&gt;));&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;return&lt;/SPAN&gt;&lt;SPAN&gt; sdt.getDate();&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; },&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;but getting javascript error&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 24 Oct 2025 12:26:11 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/need-to-get-the-day-based-on-entered-date-amp-time/m-p/3412362#M1234476</guid>
      <dc:creator>is_12</dc:creator>
      <dc:date>2025-10-24T12:26:11Z</dc:date>
    </item>
    <item>
      <title>Re: Need to Get the day based on entered date &amp; time</title>
      <link>https://www.servicenow.com/community/developer-forum/need-to-get-the-day-based-on-entered-date-amp-time/m-p/3412370#M1234479</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/453945"&gt;@is_12&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;didn't get the requirement.&lt;/P&gt;
&lt;P&gt;you need to add the value 21 (value in earlier variable) to the date entered by user?&lt;/P&gt;</description>
      <pubDate>Fri, 24 Oct 2025 12:40:45 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/need-to-get-the-day-based-on-entered-date-amp-time/m-p/3412370#M1234479</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2025-10-24T12:40:45Z</dc:date>
    </item>
    <item>
      <title>Re: Need to Get the day based on entered date &amp; time</title>
      <link>https://www.servicenow.com/community/developer-forum/need-to-get-the-day-based-on-entered-date-amp-time/m-p/3412624#M1234543</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/265966"&gt;@Ankur Bawiskar&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me explain you&lt;BR /&gt;Let say user has selected the start date as today(25th) &amp;amp; day of the month as 28(28 is nothing but date) &amp;amp; select month as Every month&lt;BR /&gt;then day1 should be from day of month ie 28th +1 rather than start date+1&lt;BR /&gt;similarly let say select month is quatarely then it should be 28th +3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 24 Oct 2025 18:55:36 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/need-to-get-the-day-based-on-entered-date-amp-time/m-p/3412624#M1234543</guid>
      <dc:creator>is_12</dc:creator>
      <dc:date>2025-10-24T18:55:36Z</dc:date>
    </item>
    <item>
      <title>Re: Need to Get the day based on entered date &amp; time</title>
      <link>https://www.servicenow.com/community/developer-forum/need-to-get-the-day-based-on-entered-date-amp-time/m-p/3422021#M1236485</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/265966"&gt;@Ankur Bawiskar&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;For Yearly, if it is leap year,then it should be +366 else 365&lt;/P&gt;&lt;P&gt;How, can I achieve it ?&lt;/P&gt;</description>
      <pubDate>Fri, 07 Nov 2025 11:20:01 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/need-to-get-the-day-based-on-entered-date-amp-time/m-p/3422021#M1236485</guid>
      <dc:creator>is_12</dc:creator>
      <dc:date>2025-11-07T11:20:01Z</dc:date>
    </item>
    <item>
      <title>Re: Need to Get the day based on entered date &amp; time</title>
      <link>https://www.servicenow.com/community/developer-forum/need-to-get-the-day-based-on-entered-date-amp-time/m-p/3422061#M1236496</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/453945"&gt;@is_12&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think you can enhance the logic for this.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":light_bulb:"&gt;💡&lt;/span&gt; If my response helped, please mark it as correct &lt;span class="lia-unicode-emoji" title=":white_heavy_check_mark:"&gt;✅&lt;/span&gt; and close the thread &lt;span class="lia-unicode-emoji" title=":locked:"&gt;🔒&lt;/span&gt;— this helps future readers find the solution faster! &lt;span class="lia-unicode-emoji" title=":folded_hands:"&gt;🙏&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Nov 2025 12:06:12 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/need-to-get-the-day-based-on-entered-date-amp-time/m-p/3422061#M1236496</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2025-11-07T12:06:12Z</dc:date>
    </item>
  </channel>
</rss>

