<?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 Set date to specific time in Developer forum</title>
    <link>https://www.servicenow.com/community/developer-forum/set-date-to-specific-time/m-p/1438636#M95562</link>
    <description>&lt;P&gt;Hello, &amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to automatically set a due date field to whatever day is chosen but I want the time to ALWAYS be at 11:59 pm (last hour of due date). The code I'm using is placed on a task box inside a workflow. The result I'm getting is not what I'm looking for. Does anybody know if this code is the problem?&lt;/P&gt;&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;//current.comments = "Due date proposed: " + current.variables.due_date; &amp;nbsp; var dateDueDate = due_date.toString()+ ' 23:59:59'; &amp;nbsp; &amp;nbsp; var dueDate = new GlideDateTime(dateDueDate); &amp;nbsp; &amp;nbsp; var dayOfWeek = parseInt(dueDate.getDayOfWeekLocalTime()); &amp;nbsp; &amp;nbsp; dueDate.setDisplayValue(dateDueDate, "yyyy-MM-dd HH:mm:ss"); dateString = "dd/mm/yyyy"; &amp;nbsp; &amp;nbsp; current.due_date = current.variables.due_date; var gdt = current.due_date.getGlideObject(); gdt.addDaysUTC(1);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 11 Sep 2017 22:41:08 GMT</pubDate>
    <dc:creator>samuelscott</dc:creator>
    <dc:date>2017-09-11T22:41:08Z</dc:date>
    <item>
      <title>Set date to specific time</title>
      <link>https://www.servicenow.com/community/developer-forum/set-date-to-specific-time/m-p/1438636#M95562</link>
      <description>&lt;P&gt;Hello, &amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to automatically set a due date field to whatever day is chosen but I want the time to ALWAYS be at 11:59 pm (last hour of due date). The code I'm using is placed on a task box inside a workflow. The result I'm getting is not what I'm looking for. Does anybody know if this code is the problem?&lt;/P&gt;&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;//current.comments = "Due date proposed: " + current.variables.due_date; &amp;nbsp; var dateDueDate = due_date.toString()+ ' 23:59:59'; &amp;nbsp; &amp;nbsp; var dueDate = new GlideDateTime(dateDueDate); &amp;nbsp; &amp;nbsp; var dayOfWeek = parseInt(dueDate.getDayOfWeekLocalTime()); &amp;nbsp; &amp;nbsp; dueDate.setDisplayValue(dateDueDate, "yyyy-MM-dd HH:mm:ss"); dateString = "dd/mm/yyyy"; &amp;nbsp; &amp;nbsp; current.due_date = current.variables.due_date; var gdt = current.due_date.getGlideObject(); gdt.addDaysUTC(1);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Sep 2017 22:41:08 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/set-date-to-specific-time/m-p/1438636#M95562</guid>
      <dc:creator>samuelscott</dc:creator>
      <dc:date>2017-09-11T22:41:08Z</dc:date>
    </item>
    <item>
      <title>Re: Set date to specific time</title>
      <link>https://www.servicenow.com/community/developer-forum/set-date-to-specific-time/m-p/1438637#M95563</link>
      <description>&lt;P&gt;If your date field is a Date and Time type of field, it will store the time in UTC time zone. You can do something like:&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;PRE __default_attr="javascript" __jive_macro_name="code" class="_jivemacro_uid_15051698946539869 jive_macro_code jive_text_macro" data-renderedposition="50_8_1192_32" jivemacro_uid="_15051698946539869" modifiedtitle="true"&gt;&lt;P&gt;var dateTimeObj = new GlideDateTime(current.your_date_field); &lt;/P&gt;&lt;BR /&gt;&lt;P&gt;var myDate = dateTimeObj.getLocalDate() + " 23:59:59");&lt;/P&gt;&lt;BR /&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Sep 2017 22:46:17 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/set-date-to-specific-time/m-p/1438637#M95563</guid>
      <dc:creator>EdwinCoronado</dc:creator>
      <dc:date>2017-09-11T22:46:17Z</dc:date>
    </item>
    <item>
      <title>Re: Set date to specific time</title>
      <link>https://www.servicenow.com/community/developer-forum/set-date-to-specific-time/m-p/1438638#M95564</link>
      <description>&lt;P&gt;Please check if this helps.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;current.dueDate = current.dueDate.toString().split(' ')[0]+ ' ' +'23:59:59';&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 12 Sep 2017 02:22:36 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/set-date-to-specific-time/m-p/1438638#M95564</guid>
      <dc:creator>Shishir Srivast</dc:creator>
      <dc:date>2017-09-12T02:22:36Z</dc:date>
    </item>
    <item>
      <title>Re: Set date to specific time</title>
      <link>https://www.servicenow.com/community/developer-forum/set-date-to-specific-time/m-p/1438639#M95565</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; Please use this snippet.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P style="color: #000000; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 12px;"&gt;&lt;/P&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #0000ff;"&gt;var&lt;/SPAN&gt; &lt;SPAN style="color: #001080;"&gt;format&lt;/SPAN&gt; = &lt;SPAN style="color: #001080;"&gt;gs&lt;/SPAN&gt;.&lt;SPAN style="color: #795e26;"&gt;getUser&lt;/SPAN&gt;().&lt;SPAN style="color: #795e26;"&gt;getDateTimeFormat&lt;/SPAN&gt;() + &lt;SPAN style="color: #a31515;"&gt;""&lt;/SPAN&gt;;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;var&lt;/SPAN&gt; &lt;SPAN style="color: #001080;"&gt;result&lt;/SPAN&gt; = &lt;SPAN style="color: #a31515;"&gt;""&lt;/SPAN&gt;;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;SPAN style="color: #af00db;"&gt;if&lt;/SPAN&gt;(&lt;SPAN style="color: #001080;"&gt;format&lt;/SPAN&gt;.&lt;SPAN style="color: #795e26;"&gt;indexOf&lt;/SPAN&gt;(&lt;SPAN style="color: #a31515;"&gt;'h'&lt;/SPAN&gt;) &amp;lt; &lt;SPAN style="color: #09885a;"&gt;0&lt;/SPAN&gt; &amp;amp;&amp;amp; &lt;SPAN style="color: #001080;"&gt;format&lt;/SPAN&gt;.&lt;SPAN style="color: #795e26;"&gt;indexOf&lt;/SPAN&gt;(&lt;SPAN style="color: #a31515;"&gt;'a'&lt;/SPAN&gt;) &amp;lt; &lt;SPAN style="color: #09885a;"&gt;0&lt;/SPAN&gt;)&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &lt;SPAN style="color: #001080;"&gt;result&lt;/SPAN&gt; = &lt;SPAN style="color: #a31515;"&gt;"Due date proposed: "&lt;/SPAN&gt; + &lt;SPAN style="color: #001080;"&gt;current&lt;/SPAN&gt;.&lt;SPAN style="color: #001080;"&gt;variables&lt;/SPAN&gt;.&lt;SPAN style="color: #001080;"&gt;due_date&lt;/SPAN&gt; + &lt;SPAN style="color: #a31515;"&gt;"11:59";&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;SPAN style="color: #af00db;"&gt;else&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &lt;SPAN style="color: #001080;"&gt;result&lt;/SPAN&gt; = &amp;nbsp; &lt;SPAN style="color: #a31515;"&gt;"Due date proposed: "&lt;/SPAN&gt; + &lt;SPAN style="color: #001080;"&gt;current&lt;/SPAN&gt;.&lt;SPAN style="color: #001080;"&gt;variables&lt;/SPAN&gt;.&lt;SPAN style="color: #001080;"&gt;due_date&lt;/SPAN&gt; + &lt;SPAN style="color: #a31515;"&gt;"23:59";&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;/DIV&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;SPAN style="background-color: #e8e8e8; color: #666666; font-family: monospace;"&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;SPAN style="background-color: #e8e8e8; color: #666666; font-family: monospace;"&gt;- YLN&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 12 Sep 2017 03:17:31 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/set-date-to-specific-time/m-p/1438639#M95565</guid>
      <dc:creator>lakshminarayan4</dc:creator>
      <dc:date>2017-09-12T03:17:31Z</dc:date>
    </item>
    <item>
      <title>Re: Set date to specific time</title>
      <link>https://www.servicenow.com/community/developer-forum/set-date-to-specific-time/m-p/1438640#M95566</link>
      <description>&lt;P&gt;Hi Edwin,&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;But where are you setting the due_date field to the new value? And in your code, aren't you dealing with a date/time format all the time and end up adding the &lt;SPAN style="color: #0000ff; font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px; background-color: #f6f6f6;"&gt;" 23:59:59" &lt;SPAN style="color: #303030;"&gt;at the end?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;When adding you recommended code as shown below,&lt;/P&gt;&lt;BR /&gt;&lt;PRE __default_attr="javascript" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_15052305330413804 jive_text_macro" data-renderedposition="128_8_1191_256" jivemacro_uid="_15052305330413804"&gt;&lt;P&gt;//current.comments = "Due date proposed: " + current.variables.due_date;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;/*var dateDueDate = due_date.toString()+ ' 23:59:59';&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; var dueDate = new GlideDateTime(dateDueDate);&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; var dayOfWeek = parseInt(dueDate.getDayOfWeekLocalTime());&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; dueDate.setDisplayValue(dateDueDate, "yyyy-MM-dd HH:mm:ss");&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;dateString = "dd/mm/yyyy";&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;*/&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;var dateTimeObj = new GlideDateTime(current.due_date); &amp;nbsp; &amp;nbsp; &lt;/P&gt;&lt;BR /&gt;&lt;P&gt;var myDate = dateTimeObj.getLocalDate() + " 23:59:59";&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;current.due_date = current.variables.due_date;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;var gdt = current.due_date.getGlideObject();&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;gdt.addDaysUTC(1);&lt;/P&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;I get the following result on the targeted field:&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="find_real_file.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/159700i280805C0CB320FFE/image-size/large?v=v2&amp;amp;px=999" role="button" title="find_real_file.png" alt="find_real_file.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;It seems as if it is adding the actual string value as an integer rather than concatenating the string&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 12 Sep 2017 15:10:15 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/set-date-to-specific-time/m-p/1438640#M95566</guid>
      <dc:creator>samuelscott</dc:creator>
      <dc:date>2017-09-12T15:10:15Z</dc:date>
    </item>
    <item>
      <title>Re: Set date to specific time</title>
      <link>https://www.servicenow.com/community/developer-forum/set-date-to-specific-time/m-p/1438641#M95567</link>
      <description>&lt;P&gt;Hi Shishir,&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;When placing your code as shown below, i get the following result.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;PRE __default_attr="javascript" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_1505231234549290 jive_text_macro" data-renderedposition="88_8_1168_272" jivemacro_uid="_1505231234549290"&gt;&lt;P&gt;//current.comments = "Due date proposed: " + current.variables.due_date;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;/*var dateDueDate = due_date.toString()+ ' 23:59:59';&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; var dueDate = new GlideDateTime(dateDueDate);&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; var dayOfWeek = parseInt(dueDate.getDayOfWeekLocalTime());&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; dueDate.setDisplayValue(dateDueDate, "yyyy-MM-dd HH:mm:ss");&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;dateString = "dd/mm/yyyy";&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;*/&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;current.dueDate = current.dueDate.toString().split(' ')[0]+ ' ' +'23:59:59';&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;current.due_date = current.variables.due_date;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;var gdt = current.due_date.getGlideObject();&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;gdt.addDaysUTC(1);&lt;/P&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="find_real_file.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/159704i3226EFD08B54C510/image-size/large?v=v2&amp;amp;px=999" role="button" title="find_real_file.png" alt="find_real_file.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 12 Sep 2017 15:47:31 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/set-date-to-specific-time/m-p/1438641#M95567</guid>
      <dc:creator>samuelscott</dc:creator>
      <dc:date>2017-09-12T15:47:31Z</dc:date>
    </item>
    <item>
      <title>Re: Set date to specific time</title>
      <link>https://www.servicenow.com/community/developer-forum/set-date-to-specific-time/m-p/1438642#M95568</link>
      <description>&lt;P&gt;can you please just have this line and test, &lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important;"&gt;current.&lt;SPAN style="color: #000000; font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px;"&gt;variables.&lt;/SPAN&gt;dueDate = current.&lt;SPAN style="color: #000000; font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px;"&gt;variables.&lt;/SPAN&gt;dueDate.toString().split(&lt;SPAN class="string" style="font-weight: inherit; font-style: inherit; color: blue; font-size: 9pt !important;"&gt;' ')[0]+ ' ' +'23:59:59'&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important;"&gt;; &amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;are you trying to add 1 day in due date? if this is the case the i think, you can try in this way.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 12px;"&gt;var &lt;SPAN style="color: #008200; font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px;"&gt;dateDueDate = &lt;/SPAN&gt;current.&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif;"&gt;variables.&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 12px;"&gt;dueDate;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;SPAN class="comment" style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: #008200;"&gt;var dueDate = new GlideDateTime(dateDueDate);&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;SPAN style="color: #008200; font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif;"&gt;dueDate.&lt;SPAN style="color: #000000; font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px;"&gt;addDaysUTC(&lt;/SPAN&gt;&lt;SPAN class="number" style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: green;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: #000000;"&gt;);&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif;"&gt;&lt;SPAN style="color: #000000; font-size: 12px;"&gt;current.&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif;"&gt;variables.&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 12px;"&gt;dueDate = &lt;SPAN style="color: #008200; font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px;"&gt;dueDate&lt;/SPAN&gt;.&lt;SPAN style="color: #008200; font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px;"&gt;setDisplayValue&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 12px;"&gt;.split(&lt;/SPAN&gt;&lt;SPAN class="string" style="font-style: inherit; font-weight: inherit; color: blue; font-size: 9pt !important;"&gt;' ')[0]+ ' ' +'23:59:59'&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-style: inherit; font-weight: inherit; font-size: 9pt !important;"&gt;; &amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 12 Sep 2017 16:09:52 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/set-date-to-specific-time/m-p/1438642#M95568</guid>
      <dc:creator>Shishir Srivast</dc:creator>
      <dc:date>2017-09-12T16:09:52Z</dc:date>
    </item>
    <item>
      <title>Re: Set date to specific time</title>
      <link>https://www.servicenow.com/community/developer-forum/set-date-to-specific-time/m-p/1438643#M95569</link>
      <description>&lt;P&gt;but where is the variable dueDate coming from? it doesn't exist in my form....&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;i tried this, but it didn't do the trick:&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;PRE __default_attr="javascript" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_15052359926357138 jive_text_macro" data-renderedposition="108_8_1191_48" jivemacro_uid="_15052359926357138"&gt;&lt;P&gt;current.due_date = new GlideDateTime(current.due_date.toString().split(' ')[0]+ ' 23:59:59');&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;var gdt = current.due_date.getGlideObject();&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;gdt.addDaysUTC(1);&lt;/P&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;i think what you meant was:&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;PRE __default_attr="javascript" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_15052365825782455 jive_text_macro" data-renderedposition="236_8_1191_64" jivemacro_uid="_15052365825782455"&gt;&lt;P&gt;var dateDueDate = current.due_date;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;var dueDate = new GlideDateTime(dateDueDate);&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;due_date.addDaysUTC(1);&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;current.due_date = due_date.setDisplayValue.split(' ')[0]+ ' ' +'23:59:59'; &lt;/P&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;and yes....I'm trying to add 1 day, and that part is actually working&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 12 Sep 2017 17:04:14 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/set-date-to-specific-time/m-p/1438643#M95569</guid>
      <dc:creator>samuelscott</dc:creator>
      <dc:date>2017-09-12T17:04:14Z</dc:date>
    </item>
    <item>
      <title>Re: Set date to specific time</title>
      <link>https://www.servicenow.com/community/developer-forum/set-date-to-specific-time/m-p/1438644#M95570</link>
      <description>&lt;P&gt;this is the correct answer:&lt;/P&gt;&lt;BR /&gt;&lt;PRE __default_attr="javascript" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_15052527669789773 jive_text_macro" data-renderedposition="27.4921875_7.9921875_1191_75" jivemacro_uid="_15052527669789773"&gt;&lt;P&gt;var dateDueDate = current.due_date;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;var dueDate = new GlideDateTime(dateDueDate);&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;var arrDate = [];&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;arrDate = dueDate.toString().split(' ');&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;current.due_date.setDisplayValue(arrDate[0]+ ' 23:59:59','yyyy-MM-dd HH:mm:ss'); &lt;/P&gt;&lt;BR /&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Sep 2017 21:46:10 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/set-date-to-specific-time/m-p/1438644#M95570</guid>
      <dc:creator>samuelscott</dc:creator>
      <dc:date>2017-09-12T21:46:10Z</dc:date>
    </item>
    <item>
      <title>Re: Set date to specific time</title>
      <link>https://www.servicenow.com/community/developer-forum/set-date-to-specific-time/m-p/1438645#M95571</link>
      <description>&lt;P&gt;Seems weird there's no other way to do this without parsing strings.&lt;/P&gt;</description>
      <pubDate>Sun, 14 Jun 2020 13:23:44 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/set-date-to-specific-time/m-p/1438645#M95571</guid>
      <dc:creator>MG Casey</dc:creator>
      <dc:date>2020-06-14T13:23:44Z</dc:date>
    </item>
    <item>
      <title>Re: Set date to specific time</title>
      <link>https://www.servicenow.com/community/developer-forum/set-date-to-specific-time/m-p/1438646#M95572</link>
      <description>&lt;P&gt;This worked fine!!!&lt;/P&gt;
&lt;P&gt;In my case, original date field was in blank, and I needed to set it up with a new and fixed date.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thx&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Dec 2020 02:20:06 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/set-date-to-specific-time/m-p/1438646#M95572</guid>
      <dc:creator>User342536</dc:creator>
      <dc:date>2020-12-15T02:20:06Z</dc:date>
    </item>
    <item>
      <title>Re: Set date to specific time</title>
      <link>https://www.servicenow.com/community/developer-forum/set-date-to-specific-time/m-p/1438647#M95573</link>
      <description>&lt;P&gt;This will not work if the user has selected a different display format for dates in ServiceNow (which is uncommon, but could be around 5-10% of your userbase).&lt;/P&gt;
&lt;P&gt;I'd recommend this:&lt;/P&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;var dueDate = new GlideDateTime(current.getValue("due_date"));
var dueDateMidnight = new GlideDateTime();
dueDateMidnight.setDisplayValueInternal(String(dueDate.getLocalDate()) + " 23:59:59");

current.setValue("due_date", dueDateMidnight.getValue());&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 15 Dec 2020 13:46:38 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/set-date-to-specific-time/m-p/1438647#M95573</guid>
      <dc:creator>MG Casey</dc:creator>
      <dc:date>2020-12-15T13:46:38Z</dc:date>
    </item>
    <item>
      <title>Re: Set date to specific time</title>
      <link>https://www.servicenow.com/community/developer-forum/set-date-to-specific-time/m-p/1438648#M95574</link>
      <description>&lt;P&gt;I recently had this issue and came up with the following solution which only uses documented methods and a minimal amount of string spaghetti:&lt;/P&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;function setTime(oldDate, time) {
  var newDate = new GlideDateTime('1970-01-01 ' + time);
  if (!newDate.isValid()) {
    throw new Error('Invalid time provided: ' + time);
  }
  newDate.setYearUTC(oldDate.getYearUTC());
  newDate.setMonthUTC(oldDate.getMonthUTC());
  newDate.setDayOfMonthUTC(oldDate.getDayOfMonthUTC());
  return newDate;
}&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can use it like this:&lt;/P&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;var todayAtNoon = setTime(new GlideDateTime(), '12:00:00');&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;which would get you a GlideDateTime representing today at noon.&lt;/P&gt;</description>
      <pubDate>Tue, 04 May 2021 20:12:01 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/set-date-to-specific-time/m-p/1438648#M95574</guid>
      <dc:creator>Eric Medina</dc:creator>
      <dc:date>2021-05-04T20:12:01Z</dc:date>
    </item>
    <item>
      <title>Re: Set date to specific time</title>
      <link>https://www.servicenow.com/community/developer-forum/set-date-to-specific-time/m-p/1438649#M95575</link>
      <description>&lt;P&gt;Old post new script. This one preserves the locality of the time as often we want a local representation of time so it's consistent when comparing with other objects in the system.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;var myDateTimeField = ; //Set variable to the date/time field you want to change
var time = ; //Set the time as a string, i.e. "12:30:00"

var newDateTime = setTime(myDateTimeField, time); 
var localDateTime = newDateTime.getDisplayValue();

function setTime(DateTime, time) {

        //Convert to GlideDateTime
        var oldDateTime = new GlideDateTime(DateTime); 

        var gtime1 = new GlideTime();
        gtime1.setValue(time);

        var newDateTime = new GlideDateTime();

        //Preserves the date in local time but sets the time portion to 00:00:00
        newDateTime.setDisplayValue(oldDateTime.getLocalDate());

        //Add the time portion on
        newDateTime.add(gtime1);

        return newDateTime;
    }&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Mar 2022 09:38:56 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/set-date-to-specific-time/m-p/1438649#M95575</guid>
      <dc:creator>Tim Grindlay</dc:creator>
      <dc:date>2022-03-30T09:38:56Z</dc:date>
    </item>
  </channel>
</rss>

