<h2>GlideDateTime - subtract(GlideDateTime start, GlideDateTime end)</h2><br/><div style="overflow-x:auto"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head><meta content="text/html; charset=UTF-8" /><meta name="copyright" content="(C) Copyright 2025" /><meta name="DC.rights.owner" content="(C) Copyright 2025" /><meta name="generator" content="DITA-OT" /><meta name="DC.type" content="concept" /><meta name="DC.title" content="GlideDateTime" /><meta name="abstract" content="The GlideDateTime class provides methods for performing operations on GlideDateTime objects." /><meta name="description" content="The GlideDateTime class provides methods for performing operations on GlideDateTime objects." /><meta name="DC.subject" content="GlideDateTime, GlideDateTime(), GlideDateTime(String dateTime), GlideDateTime(GlideDateTime gDT), add(Number milliseconds), add(GlideTime time), addDays(Number days), addDaysLocalTime(Number days), addDaysUTC(Number days), addSeconds(Number seconds), addWeeks(Number weeks), addWeeksLocalTime(Number weeks), addWeeksUTC(Number weeks), addMonths(Number months), addMonthsLocalTime(Number months), addMonthsUTC(Number months), addYears(Number years), addYearsLocalTime(Number years), addYearsUTC(Number years), compareTo(GlideDateTime dateTime), equals(Object GDT), getDate(), getDayOfMonth(), getDayOfMonthLocalTime(), getDayOfMonthUTC(), getDayOfWeek(), getDayOfWeekLocalTime(), getDayOfWeekUTC(), getDaysInMonth(), getDaysInMonthLocalTime(), getDaysInMonthUTC(), getDisplayValue(), getDisplayValueInternal(), getDisplayValueLang(), getDSTOffset(), getErrorMsg(), getInternalFormattedLocalTime(), getInternalMidnight(Number dayOfTheWeek), getLocalDate(), getLocalTime(), getMonth(), getMonthLocalTime(), getMonthUTC(), getNumericValue(), getSpanTime(Number dayOfWeek), getTime(), getTZOffset(), getUserFormattedLocalTime(), getUserTimeZone(), getUTCMidnight(Number dayOfTheWeek), getValue(), getWeekOfYearLocalTime(), getWeekOfYearUTC(), getYear(), getYearLocalTime(), getYearUTC(), hasDate(), isDST(), isValid(), setDayOfMonth(Number day), setDayOfMonthLocalTime(Number day), setDayOfMonthUTC(Number day), setDisplayValue(String asDisplayed), setDisplayValue(String dateTime, String format), setDisplayValueInternal(String dateTime), setDisplayValueInternalWithAlternates(String dateTime), setDisplayValueLang(String dateTime, String style), setDisplayValueLang(), setGlideDateTime(GlideDateTime gDT), setInitialValue(String dateTime), setMonth(Number month), setMonthLocalTime(Number month), setMonthUTC(Number month), setNumericValue(Number milliseconds), setTZ(TimeZone timeZone), setValue(Object dateTime), setValueUTC(String dateTime, String format), setYear(Number year), setYearLocalTime(Number year), setYearUTC(Number year), subtract(GlideTime time), subtract(Number milliseconds), subtract(GlideDateTime start, GlideDateTime end), toString()" /><meta name="keywords" content="GlideDateTime, GlideDateTime(), GlideDateTime(String dateTime), GlideDateTime(GlideDateTime gDT), add(Number milliseconds), add(GlideTime time), addDays(Number days), addDaysLocalTime(Number days), addDaysUTC(Number days), addSeconds(Number seconds), addWeeks(Number weeks), addWeeksLocalTime(Number weeks), addWeeksUTC(Number weeks), addMonths(Number months), addMonthsLocalTime(Number months), addMonthsUTC(Number months), addYears(Number years), addYearsLocalTime(Number years), addYearsUTC(Number years), compareTo(GlideDateTime dateTime), equals(Object GDT), getDate(), getDayOfMonth(), getDayOfMonthLocalTime(), getDayOfMonthUTC(), getDayOfWeek(), getDayOfWeekLocalTime(), getDayOfWeekUTC(), getDaysInMonth(), getDaysInMonthLocalTime(), getDaysInMonthUTC(), getDisplayValue(), getDisplayValueInternal(), getDisplayValueLang(), getDSTOffset(), getErrorMsg(), getInternalFormattedLocalTime(), getInternalMidnight(Number dayOfTheWeek), getLocalDate(), getLocalTime(), getMonth(), getMonthLocalTime(), getMonthUTC(), getNumericValue(), getSpanTime(Number dayOfWeek), getTime(), getTZOffset(), getUserFormattedLocalTime(), getUserTimeZone(), getUTCMidnight(Number dayOfTheWeek), getValue(), getWeekOfYearLocalTime(), getWeekOfYearUTC(), getYear(), getYearLocalTime(), getYearUTC(), hasDate(), isDST(), isValid(), setDayOfMonth(Number day), setDayOfMonthLocalTime(Number day), setDayOfMonthUTC(Number day), setDisplayValue(String asDisplayed), setDisplayValue(String dateTime, String format), setDisplayValueInternal(String dateTime), setDisplayValueInternalWithAlternates(String dateTime), setDisplayValueLang(String dateTime, String style), setDisplayValueLang(), setGlideDateTime(GlideDateTime gDT), setInitialValue(String dateTime), setMonth(Number month), setMonthLocalTime(Number month), setMonthUTC(Number month), setNumericValue(Number milliseconds), setTZ(TimeZone timeZone), setValue(Object dateTime), setValueUTC(String dateTime, String format), setYear(Number year), setYearLocalTime(Number year), setYearUTC(Number year), subtract(GlideTime time), subtract(Number milliseconds), subtract(GlideDateTime start, GlideDateTime end), toString()" /><meta name="DC.relation" scheme="URI" content="../../../../../build/applications/concept/api-server.html" /><meta name="DC.relation" scheme="URI" content="../../../../../build/applications/concept/api-implementation-reference.html" /><meta name="DC.relation" scheme="URI" content="../../../../../build/applications/concept/api-reference.html" /><meta name="DC.creator" content="ServiceNow" /><meta name="DC.date.created" content="2023-08-03" /><meta name="DC.date.modified" content="2024-08-01" /><meta name="mini-toc" content="no-sections" /><meta name="DC.format" content="XHTML" /><meta name="DC.identifier" content="c_GlideDateTimeAPI" /><link rel="stylesheet" type="text/css" href="../../../../../CSS/commonltr.css" /><title>GlideDateTime</title></head><body class="api-class"> <div class="nested0" id="c_GlideDateTimeAPI"> <h1 class="title topictitle1" id="ariaid-title1">GlideDateTime</h1> <div class="body conbody"><p class="shortdesc">The <span class="keyword apiname">GlideDateTime</span> class provides methods for performing operations on GlideDateTime objects.</p> <p class="p">Use the <span class="keyword apiname">GlideDateTime</span> methods to perform date-time operations, such as instantiating a GlideDateTime object, performing date-time calculations, formatting a date-time, or converting between date-time formats.</p> <p class="p">For guidance on date time input strings with a list of common format conflicts, refer to <a class="xref" href="../../../../../script/glide-server-apis/topic/p_GlideServerAPIs.html#date-and-time-format-guidelines" title="You can specify a date format with a sequence of specific date and time pattern strings. A pattern string consists of one or more uppercase and lowercase letters from A to Z. Any text within quotation marks is ignored and is instead copied into the date output.">Date and time format guidelines</a>.</p> </div> <div class="related-links"> <div class="familylinks"> <div class="parentlink"><strong>Parent Topic:</strong> <a class="link" href="../../../../../build/applications/concept/api-server.html" title="Use server APIs in scripts to change the functionality of applications, or when you create new applications.">Server API reference</a></div> </div> </div><div class="topic reference nested1 api-constructor" id="r_GDT-GlideDateTime"> <h2 class="title topictitle2" id="ariaid-title2">GlideDateTime - GlideDateTime()</h2> <div class="body refbody"><p class="shortdesc">Instantiates a new <span class="keyword apiname">GlideDateTime</span> object with the current date and time.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-GlideDateTime__table_qpq_slc_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 1. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e166">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e169">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e172">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e166 ">None</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e169 "> </td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e172 "> </td></tr></tbody></table> </div> </div> <div class="example" id="r_GDT-GlideDateTime__example_c5g_rws_l5b"> <p class="p">This example instantiates a <span class="keyword apiname">GlideDateTime</span> object.</p> <pre class="pre codeblock"><code>var gdt = new GlideDateTime(); gs.info(gdt);</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>2022-08-08 16:51:44</code></pre> </div> </div> </div> <div class="topic reference nested1 api-constructor" id="r_GDT-GlideDateTime_S"> <h2 class="title topictitle2" id="ariaid-title3">GlideDateTime - GlideDateTime(String dateTime)</h2> <div class="body refbody"><p class="shortdesc">Instantiates a new <span class="keyword apiname">GlideDateTime</span> object using the passed-in date and time value.</p> <div class="section"> <div class="p">The system attempts to match the passed-in value with the specified internal system format. If the argument does not match the system format, the system attempts to match it to one of the following formats in this order: <ul class="ul" id="r_GDT-GlideDateTime_S__ul_xgq_hmz_lnb"><li class="li">yyyy-MM-dd HH:mm:ss</li><li class="li">MM/dd/yyyy HH:mm:ss</li><li class="li">MM-dd-yyyy HH:mm:ss</li><li class="li">MM-dd-yyyy HH:mm</li><li class="li">MM-dd-yyyy</li><li class="li">MM/dd/yyyy</li><li class="li">dd-MM-yyyy HH:mm:ss</li><li class="li">dd-MM-yyyy HH.mm.ss</li><li class="li">dd-MM-yyyy HH.mm</li><li class="li">dd-MM-yy HH.mm.ss</li><li class="li">dd/MM/yyyy</li><li class="li">dd-MM-yyyy</li><li class="li">yyyy-MM-dd HH:mm</li><li class="li">yyyy-MM-dd</li><li class="li">dd.MM.yyyy HH:mm:ss</li><li class="li">dd.MM.yyyy HH.mm.ss</li><li class="li">dd.MM.yyyy hh:mm:ss a</li><li class="li">dd.MM.yyyy hh.mm.ss a</li><li class="li">dd.MM.yyyy</li></ul> <div class="note"><span class="notetitle">Note:</span> The following format is not supported:<ul class="ul" id="r_GDT-GlideDateTime_S__ul_udg_d5w_lcc"><li class="li">yyyy-MM-dd'T'HH:mm:ss.SSSZ</li></ul> </div> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-GlideDateTime_S__table_ufk_jmc_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 2. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e346">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e349">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e352">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e346 ">dateTime</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e349 ">String</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e352 ">UTC date and time to set in the <span class="keyword apiname">GlideDateTime</span> object.</td></tr></tbody></table> </div> </div> <div class="example"> <p class="p">This example shows how to instantiate a <span class="keyword apiname">GlideDateTime</span> object using a string.</p> <pre class="pre codeblock"><code>var gdt = new GlideDateTime("2023-01-01 12:00:00"); gs.info(gdt);</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>2023-01-01 12:00:00</code></pre> </div> </div> </div> <div class="topic reference nested1 api-constructor" id="r_GDT-GlideDateTime_GDT"> <h2 class="title topictitle2" id="ariaid-title4">GlideDateTime - GlideDateTime(GlideDateTime gdt)</h2> <div class="body refbody"><p class="shortdesc">Instantiates a new <span class="keyword apiname">GlideDateTime</span> object set to the time of a specified <span class="keyword apiname">GlideDateTime</span> object.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-GlideDateTime_GDT__table_jqw_cnc_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 3. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e463">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e466">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e469">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e463 ">gdt</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e466 ">GlideDateTime</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e469 ">Object used to set the time of the new object.</td></tr></tbody></table> </div> </div> <div class="example" id="r_GDT-GlideDateTime_GDT__id_ygt_5yq_22c"> <p class="p">This example shows how to instantiate a <span class="keyword apiname">GlideDateTime</span> object (gdt1) using a string in the format <code class="ph codeph">yyyy-MM-dd HH:mm:ss</code>, and a second <span class="keyword apiname">GlideDateTime</span> object (gdt2) using gdt1.</p> <pre class="pre codeblock"><code>var gdt1 = new GlideDateTime("2025-01-28 12:00:00"); // GlideDateTime(String g) var gdt2 = new GlideDateTime(gdt1); // GlideDateTime(GlideDateTime g) gs.info(gdt1); gs.info(gdt2);</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>2025-01-28 12:00:00 2025-01-28 12:00:00</code></pre> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-add_N"> <h2 class="title topictitle2" id="ariaid-title5">GlideDateTime - add(Number milliseconds)</h2> <div class="body refbody"><p class="shortdesc">Adds a specified number of milliseconds to the GlideDateTime object.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-add_N__table_x2g_nsl_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 4. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e576">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e579">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e582">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e576 ">milliseconds</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e579 ">Number</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e582 ">The number of milliseconds to add</td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-add_N__table_y2g_nsl_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 5. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e619">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e622">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e619 ">void</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e622 "> </td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime("2011-08-31 08:00:00"); gs.print(gdt.getNumericValue()); gdt.add(10); gs.print(gdt.getNumericValue());</code></pre> <div class="p">Output: <pre class="pre codeblock"><code>1314777600000 1314777600010</code></pre></div> </div> <div class="section scoped-equivalent" id="r_GDT-add_N__section_bqp_jnr_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">add()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeAdd_Number" title="Adds the specified number of milliseconds to the current GlideDateTime object.">add()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-add_GT"> <h2 class="title topictitle2" id="ariaid-title6">GlideDateTime - add(GlideTime time)</h2> <div class="body refbody"><p class="shortdesc">Adds a GlideTime object to the current GlideDateTime object.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-add_GT__table_e4r_xs2_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 6. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e732">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e735">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e738">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e732 ">time</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e735 "><a class="xref" href="../../glideTimeScoped/concept/c_GlideTimeScopedAPI.html" title="The GlideTime API provides methods for performing operations on GlideTime objects, such as instantiating GlideTime objects or working with GlideTime fields.">GlideTime</a></td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e738 ">GlideTime object whose time value to add to the specified GlideDateTime object.</td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-add_GT__table_f4r_xs2_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 7. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e783">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e786">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e783 ">void</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e786 "> </td></tr></tbody></table> </div> </div> <div class="example"> <p class="p">This example shows how to add 20 seconds to the time set in the gdt GlideDateTime object.</p> <pre class="pre codeblock"><code>var gdt = new GlideDateTime("2011-08-31 08:00:00"); var gtime1 = new GlideTime(); gtime1.setValue("00:00:20"); gdt.add(gtime1); gs.print(gdt.toString());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>2011-08-31 08:00:20</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-add_GT__section_prv_gnr_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">add()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeAdd_GlideTime_gd" title="Adds a GlideTime object to the current GlideDateTime object.">add()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-addDays_N"> <h2 class="title topictitle2" id="ariaid-title7">GlideDateTime - addDays(Number days)</h2> <div class="body refbody"><p class="shortdesc">Adds a specified number of days to the current GlideDateTime object. A negative parameter subtracts days.</p> <div class="section"> <p class="p">Use <span class="keyword apiname">addDaysLocalTime()</span> and <span class="keyword apiname">addDaysUTC()</span> instead of this method.</p> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-addDays_N__table_h1q_3t2_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 8. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e908">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e911">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e914">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e908 ">days</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e911 ">Number</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e914 ">The number of days to add. Use a negative number to subtract.</td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-addDays_N__table_i1q_3t2_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 9. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e951">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e954">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e951 ">void</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e954 "> </td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime("2011-08-31 08:00:00"); gdt.addDays(-1); gs.print(gdt.getDate());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>2011-08-30</code></pre> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-addDaysLocalTime_N"> <h2 class="title topictitle2" id="ariaid-title8">GlideDateTime - addDaysLocalTime(Number days)</h2> <div class="body refbody"><p class="shortdesc">Adds a specified number of days to the current GlideDateTime object. A negative parameter subtracts days.</p> <div class="section"> <p class="p">The method determines the local date and time equivalent to the value stored by the GlideDateTime object, then adds or subtracts days using the local date and time values.</p> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-addDaysLocalTime_N__table_ll1_xt2_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 10. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e1049">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e1052">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e1055">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e1049 ">days</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e1052 ">Number</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e1055 ">The number of days to add. Use a negative value to subtract.</td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-addDaysLocalTime_N__table_ml1_xt2_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 11. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e1092">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e1095">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e1092 ">void</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e1095 "> </td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime("2011-08-31 08:00:00"); gdt.addDaysLocalTime(-1); gs.print(gdt.getLocalDate());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>2011-08-30</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-addDaysLocalTime_N__section_hnw_5lr_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">addDaysLocalTime()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeAddDaysLocalTime_Number" title="Adds a specified number of days to the current GlideDateTime object. A negative parameter subtracts days. The method determines the local date and time equivalent to the value stored by the GlideDateTime object, then adds or subtracts days using the local date and time values.">addDaysLocalTime()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-addDaysUTC_N"> <h2 class="title topictitle2" id="ariaid-title9">GlideDateTime - addDaysUTC(Number days)</h2> <div class="body refbody"><p class="shortdesc">Adds a specified number of days to the current GlideDateTime object. A negative parameter subtracts days.</p> <div class="section"> <p class="p">The method determines the UTC date and time equivalent to the value stored by the GlideDateTime object, then adds or subtracts days using the UTC date and time values.</p> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-addDaysUTC_N__table_vyt_k52_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 12. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e1208">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e1211">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e1214">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e1208 ">days</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e1211 ">Number</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e1214 ">The number of days to add. Use a negative value to subtract.</td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-addDaysUTC_N__table_wyt_k52_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 13. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e1251">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e1254">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e1251 ">void</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e1254 "> </td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime("2011-08-31 08:00:00"); gdt.addDaysUTC(-1); gs.print(gdt.getDate());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>2011-08-30</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-addDaysUTC_N__section_ljh_ylr_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">addDaysUTC()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeAddDaysUTC_Number" title="Adds a specified number of days to the current GlideDateTime object. A negative parameter subtracts days. The method determines the UTC date and time equivalent to the value stored by the GlideDateTime object, then adds or subtracts days using the UTC date and time values.">addDaysUTC()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-addSeconds_N"> <h2 class="title topictitle2" id="ariaid-title10">GlideDateTime - addSeconds(Number seconds)</h2> <div class="body refbody"><p class="shortdesc">Adds a specified number of seconds to the GlideDateTime object.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-addSeconds_N__table_xlx_zsl_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 14. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e1365">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e1368">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e1371">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e1365 ">seconds</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e1368 ">Number</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e1371 ">The number of seconds to add</td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-addSeconds_N__table_ylx_zsl_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 15. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e1408">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e1411">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e1408 ">void</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e1411 "> </td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime("2011-12-07 08:00:00"); gdt.addSeconds(1000); gs.print(gdt.getValue());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>2011-12-07 08:16:40</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-addSeconds_N__section_mnz_gmr_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">addSeconds()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeAddSeconds_Number" title="Adds the specified number of seconds to the current GlideDateTime object.">addSeconds()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-addWeeks_N"> <h2 class="title topictitle2" id="ariaid-title11">GlideDateTime - addWeeks(Number weeks)</h2> <div class="body refbody"><p class="shortdesc">Adds a specified number of weeks to the current GlideDateTime object. A negative parameter subtracts weeks.</p> <div class="section"> <p class="p">Use <span class="keyword apiname">addWeeksLocalTime()</span> and <span class="keyword apiname">addWeeksUTC()</span> instead of this method.</p> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-addWeeks_N__table_bpk_v52_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 16. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e1530">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e1533">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e1536">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e1530 ">weeks</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e1533 ">Number</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e1536 ">The number of weeks to add. Use a negative number to subtract.</td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-addWeeks_N__table_cpk_v52_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 17. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e1573">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e1576">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e1573 ">void</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e1576 "> </td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime("2011-08-31 08:00:00"); gdt.addWeeks(-1); gs.print(gdt.getDate());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>2011-08-24</code></pre> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-addWeeksLocalTime_N"> <h2 class="title topictitle2" id="ariaid-title12">GlideDateTime - addWeeksLocalTime(Number weeks)</h2> <div class="body refbody"><p class="shortdesc">Adds a specified number of weeks to the current GlideDateTime object. A negative parameter subtracts weeks.</p> <div class="section"> <p class="p">The method determines the local date and time equivalent to the value stored by the GlideDateTime object, then adds or subtracts weeks using the local date and time values.</p> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-addWeeksLocalTime_N__table_ozv_3v2_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 18. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e1671">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e1674">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e1677">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e1671 ">weeks</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e1674 ">Number</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e1677 ">The number of weeks to add. Use a negative number to subtract.</td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-addWeeksLocalTime_N__table_pzv_3v2_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 19. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e1714">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e1717">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e1714 ">void</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e1717 "> </td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime("2011-08-31 08:00:00"); gdt.addWeeksLocalTime(-1); gs.print(gdt.getDate());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>2011-08-24</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-addWeeksLocalTime_N__section_uq1_wmr_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">addWeeksLocalTime()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeAddWeeksLocalTime_Number" title="Adds a specified number of weeks to the current GlideDateTime object. A negative parameter subtracts weeks. The method determines the local date and time equivalent to the value stored by the GlideDateTime object, then adds or subtracts weeks using the local date and time values.">addWeeksLocalTime()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-addWeeksUTC_N"> <h2 class="title topictitle2" id="ariaid-title13">GlideDateTime - addWeeksUTC(Number weeks)</h2> <div class="body refbody"><p class="shortdesc">Adds a specified number of weeks to the current GlideDateTime object. A negative parameter subtracts weeks.</p> <div class="section"> <p class="p">The method determines the UTC date and time equivalent to the value stored by the GlideDateTime object, then adds or subtracts weeks using the UTC date and time values.</p> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-addWeeksUTC_N__table_rdr_5v2_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 20. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e1830">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e1833">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e1836">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e1830 ">weeks</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e1833 ">Number</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e1836 ">The number of weeks to add. Use a negative number to subtract.</td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-addWeeksUTC_N__table_sdr_5v2_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 21. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e1873">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e1876">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e1873 ">void</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e1876 "> </td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime("2011-08-31 08:00:00"); gdt.addWeeksUTC(-1); gs.print(gdt.getDate());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>2011-08-24</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-addWeeksUTC_N__section_pnm_ymr_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">addWeeksUTC()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeAddWeeksUTC_Number" title="Adds a specified number of weeks to the current GlideDateTime object. A negative parameter subtracts weeks. The method determines the UTC date and time equivalent to the value stored by the GlideDateTime object, then adds or subtracts weeks using the UTC date and time values.">addWeeksUTC()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-addMonths_N"> <h2 class="title topictitle2" id="ariaid-title14">GlideDateTime - addMonths(Number months)</h2> <div class="body refbody"><p class="shortdesc">Adds a specified number of months to the current GlideDateTime object. A negative parameter subtracts months.</p> <div class="section"> <p class="p">Use <span class="keyword apiname">addMonthsLocalTime()</span> or <span class="keyword apiname">addMonthsUTC()</span> instead of this method.</p> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-addMonths_N__table_tgm_bkk_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 22. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e1996">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e1999">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e2002">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e1996 ">months</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e1999 ">Number</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e2002 ">The number of months to add. Use a negative number to subtract.</td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-addMonths_N__table_ugm_bkk_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 23. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e2039">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e2042">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e2039 ">void</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e2042 "> </td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime("2011-08-31 08:00:00"); gdt.addMonths(2); gs.print(gdt.getDate());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>2011-10-31</code></pre> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-addMonthsLocalTime_N"> <h2 class="title topictitle2" id="ariaid-title15">GlideDateTime - addMonthsLocalTime(Number months)</h2> <div class="body refbody"><p class="shortdesc">Adds a specified number of months to the current GlideDateTime object. A negative parameter subtracts months.</p> <div class="section"> <p class="p">The method determines the local date and time equivalent to the value stored by the GlideDateTime object, then adds or subtracts months using the local date and time values.</p> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-addMonthsLocalTime_N__table_fmn_pkk_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 24. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e2136">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e2139">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e2142">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e2136 ">months</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e2139 ">Number</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e2142 ">The number of months to add. Use a negative value to subtract.</td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-addMonthsLocalTime_N__table_gmn_pkk_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 25. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e2179">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e2182">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e2179 ">void</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e2182 "> </td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime("2011-08-31 08:00:00"); gdt.addMonthsLocalTime(2); gs.print(gdt.getDate());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>2011-10-31</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-addMonthsLocalTime_N__section_xvc_bmr_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">addMonthsLocalTime()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeAddMonthsLocalTime_Number" title="Adds a specified number of months to the current GlideDateTime object. A negative parameter subtracts months. The method determines the local date and time equivalent to the value stored by the GlideDateTime object, then adds or subtracts months using the local date and time values.">addMonthsLocalTime()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-addMonthsUTC_N"> <h2 class="title topictitle2" id="ariaid-title16">GlideDateTime - addMonthsUTC(Number months)</h2> <div class="body refbody"><p class="shortdesc">Adds a specified number of months to the current GlideDateTime object. A negative parameter subtracts months.</p> <div class="section"> <p class="p">The method determines the UTC date and time equivalent to the value stored by the GlideDateTime object, then adds or subtracts months using the UTC date and time values.</p> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-addMonthsUTC_N__table_lqp_1lk_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 26. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e2296">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e2299">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e2302">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e2296 ">months</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e2299 ">Number</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e2302 ">The number of months to add. Use a negative number to subtract.</td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-addMonthsUTC_N__table_mqp_1lk_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 27. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e2339">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e2342">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e2339 ">void</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e2342 "> </td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime("2011-08-31 08:00:00"); gdt.addMonthsUTC(2); gs.print(gdt.getDate());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>2011-10-31</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-addMonthsUTC_N__section_gxn_2mr_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">addMonthsUTC()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeAddMonthsUTC_Number" title="Adds a specified number of months to the current GlideDateTime object. A negative parameter subtracts months. The method determines the UTC date and time equivalent to the value stored by the GlideDateTime object, then adds or subtracts months using the UTC date and time values.">addMonthsUTC()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-addYears_N"> <h2 class="title topictitle2" id="ariaid-title17">GlideDateTime - addYears(Number years)</h2> <div class="body refbody"><p class="shortdesc">Adds a specified number of years to the current GlideDateTime object. A negative parameter subtracts years.</p> <div class="section"> <p class="p">Use <span class="keyword apiname">addYearsLocalTime()</span> or <span class="keyword apiname">addYearsUTC()</span> instead of this method.</p> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-addYears_N__table_fpz_mlk_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 28. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e2461">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e2464">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e2467">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e2461 ">years</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e2464 ">Number</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e2467 ">The number of years to add. Use a negative value to subtract.</td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-addYears_N__table_gpz_mlk_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 29. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e2504">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e2507">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e2504 ">void</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e2507 "> </td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime("2010-08-31 08:00:00"); gdt.addYears(1); gs.print(gdt.getDate());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>2011-08-31</code></pre> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-addYearsLocalTime_N"> <h2 class="title topictitle2" id="ariaid-title18">GlideDateTime - addYearsLocalTime(Number years)</h2> <div class="body refbody"><p class="shortdesc">Adds a specified number of years to the current GlideDateTime object. A negative parameter subtracts years.</p> <div class="section"> <p class="p">The method determines the local date and time equivalent to the value stored by the GlideDateTime object, then adds or subtracts years using the local date and time values.</p> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-addYearsLocalTime_N__table_llj_ryk_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 30. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e2602">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e2605">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e2608">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e2602 ">years</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e2605 ">Number</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e2608 ">The number of years to add. To subtract use a negative value.</td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-addYearsLocalTime_N__table_mlj_ryk_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 31. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e2645">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e2648">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e2645 ">void</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e2648 "> </td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime("2010-08-31 08:00:00"); gdt.addYearsLocalTime(1); gs.print(gdt.getDate());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>2011-08-31</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-addYearsLocalTime_N__section_yhl_bnr_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">AddYearsLocalTime()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeAddYearsLocalTime_Number" title="Adds a specified number of years to the current GlideDateTime object. A negative parameter subtracts years. The method determines the local date and time equivalent to the value stored by the GlideDateTime object, then adds or subtracts years using the local date and time values.">AddYearsLocalTime()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-addYearsUTC_N"> <h2 class="title topictitle2" id="ariaid-title19">GlideDateTime - addYearsUTC(Number years)</h2> <div class="body refbody"><p class="shortdesc">Adds a specified number of years to the current GlideDateTime object. A negative parameter subtracts years.</p> <div class="section"> <p class="p">The date and time value stored by GlideDateTime object is interpreted as being in the UTC time zone.</p> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-addYearsUTC_N__table_njl_czk_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 32. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e2761">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e2764">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e2767">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e2761 ">years</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e2764 ">Number</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e2767 ">The number of years to add. Use a negative value to subtract.</td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-addYearsUTC_N__table_ojl_czk_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 33. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e2804">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e2807">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e2804 ">void</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e2807 "> </td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime("2010-08-31 08:00:00"); gdt.addYearsUTC(1); gs.print(gdt.getDate());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>2011-08-31</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-addYearsUTC_N__section_yj1_2nr_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">addYearsUTC()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeAddYearsUTC_Number" title="Adds a specified number of years to the current GlideDateTime object. A negative parameter subtracts years. The date and time value stored by GlideDateTime object is interpreted as being in the UTC time zone.">addYearsUTC()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-compareTo_O"> <h2 class="title topictitle2" id="ariaid-title20">GlideDateTime - compareTo(Object dateTime)</h2> <div class="body refbody"><p class="shortdesc">Compares two date and time objects to determine whether one occurs before the other or if they are equivalent.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-compareTo_O__table_sc3_rbd_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 34. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e2918">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e2921">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e2924">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e2918 ">dateTime</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e2921 ">Object</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e2924 ">Date time in a GlideDateTime object</td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-compareTo_O__table_tc3_rbd_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 35. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e2961">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e2964">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e2961 ">Number</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e2964 "><ul class="ul" id="r_GDT-compareTo_O__ul_tb3_mjg_sz"><li class="li">0 = Dates are equal</li><li class="li">1 = The object's date is after the date specified in the parameter</li><li class="li">-1 = The object's date is before the date specified in the parameter</li></ul> </td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var initDate = new GlideDateTime("2011-08-01 12:00:00"); var compDate1 = new GlideDateTime("2011-08-01 12:00:00"); var compDate2 = new GlideDateTime("2011-07-31 12:00:00"); var compDate3 = new GlideDateTime("2011-08-04 16:00:00"); gs.info(initDate.compareTo(compDate1)); // Equals (0) gs.info(initDate.compareTo(compDate2)); // initDate is after compDate2 (1) gs.info(initDate.compareTo(compDate3)); // initDate is before compDate3 (-1)</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>0 1 -1</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-compareTo_O__section_opf_mnr_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">compareTo()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeCompareTo_Object_o" title="Compares two date and time objects to determine whether they are equivalent or one occurs before or after the other.">compareTo()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-equals_O"> <h2 class="title topictitle2" id="ariaid-title21">GlideDateTime - equals(Object GDT)</h2> <div class="body refbody"><p class="shortdesc">Compares an object with an existing value for equality.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-equals_O__table_njf_vvl_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 36. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e3085">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e3088">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e3091">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e3085 ">GDT</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e3088 ">Object</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e3091 ">The object to compare. Can be a GlideDateTIme object or a valid date time string.</td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-equals_O__table_ojf_vvl_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 37. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e3128">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e3131">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e3128 ">Boolean</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e3131 ">True if they are equal, false otherwise.</td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime("2011-08-31 00:00:00"); gs.print(gdt.equals("2011-09-30 00:12:01"));</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code> false</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-equals_O__section_i3p_4nr_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">equals()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeEquals_Object" title="Compares a datetime with an existing value for equality.">equals()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-getDate"> <h2 class="title topictitle2" id="ariaid-title22">GlideDateTime - getDate()</h2> <div class="body refbody"><p class="shortdesc">Returns the date stored by the GlideDateTime object. Expressed in the format yyyy-MM-dd and in the system time zone, UTC by default.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getDate__table_mjv_xq2_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 38. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e3243">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e3246">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e3249">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e3243 ">None</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e3246 "> </td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e3249 "> </td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getDate__table_njv_xq2_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 39. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e3284">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e3287">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e3284 ">String</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e3287 ">Date in the system time zone.<p class="p">Format: yyyy-MM-dd, and in the system time zone, UTC by default.</p> </td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime("2011-08-31 08:00:00"); gs.info(gdt.getDate());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>2011-08-31</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-getDate__section_xpq_tnr_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">getDate()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeGetDate" title="Returns the date stored by the GlideDateTime object. Expressed in the standard format, yyyy-MM-dd, and in the system time zone, GMT by default.">getDate()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-getDayOfMonth"> <h2 class="title topictitle2" id="ariaid-title23">GlideDateTime - getDayOfMonth()</h2> <div class="body refbody"><p class="shortdesc">Gets the current day of the month in the UTC time zone.</p> <div class="section"> <p class="p">Deprecated. Use <span class="keyword apiname">getDayOfMonthLocalTime()</span> and <span class="keyword apiname">getDayOfMonthUTC()</span> instead of this method.</p> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getDayOfMonth__table_orj_hg2_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 40. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e3409">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e3412">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e3415">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e3409 ">None</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e3412 "> </td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e3415 "> </td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getDayOfMonth__table_prj_hg2_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 41. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e3450">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e3453">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e3450 ">Number</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e3453 ">The day of the month in the UTC time zone, from 1 to 31.</td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime("2011-12-02 12:00:00"); gs.print(gdt.getDayOfMonth());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>2</code></pre> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-getDayOfMonthLocalTime"> <h2 class="title topictitle2" id="ariaid-title24">GlideDateTime - getDayOfMonthLocalTime()</h2> <div class="body refbody"><p class="shortdesc">Gets the day of the month stored by the GlideDateTime object, expressed in the current user's time zone.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getDayOfMonthLocalTime__table_e4r_wg2_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 42. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e3546">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e3549">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e3552">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e3546 ">None</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e3549 "> </td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e3552 "> </td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getDayOfMonthLocalTime__table_f4r_wg2_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 43. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e3587">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e3590">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e3587 ">Number</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e3590 ">The day of the month in the user's time zone, from 1 to 31.</td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime("2011-12-02 12:00:00"); gs.print(gdt.getDayOfMonthLocalTime());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>2</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-getDayOfMonthLocalTime__section_ap5_d4r_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">getDayOfMonthLocalTime()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeGetDayOfMonthLocalTime" title="Gets the day of the month stored by the GlideDateTime object, expressed in the current user's time zone.">getDayOfMonthLocalTime()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-getDayOfMonthUTC"> <h2 class="title topictitle2" id="ariaid-title25">GlideDateTime - getDayOfMonthUTC()</h2> <div class="body refbody"><p class="shortdesc">Gets the day of the month stored by the GlideDateTime object, expressed in the UTC time zone.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getDayOfMonthUTC__table_hhb_nh2_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 44. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e3701">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e3704">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e3707">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e3701 ">None</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e3704 "> </td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e3707 "> </td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getDayOfMonthUTC__table_ihb_nh2_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 45. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e3742">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e3745">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e3742 ">Number</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e3745 ">The day of the month in the UTC time zone, from 1 to 31.</td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime("2011-12-02 12:00:00"); gs.print(gdt.getDayOfMonthUTC());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>2</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-getDayOfMonthUTC__section_rvd_34r_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">getDayOfMonthUTC()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeGetDayOfMonthUTC" title="Gets the day of the month stored by the GlideDateTime object, expressed in the UTC time zone.">getDayOfMonthUTC()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-getDayOfWeek"> <h2 class="title topictitle2" id="ariaid-title26">GlideDateTime - getDayOfWeek()</h2> <div class="body refbody"><p class="shortdesc">Retrieves the day of the week stored by the GlideDateTime object, expressed in the user's time zone.</p> <div class="section"> <p class="p">Use <span class="keyword apiname">getDayOfWeekLocalTime()</span> and <span class="keyword apiname">getDayOfWeekUTC()</span> instead of this method.</p> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getDayOfWeek__table_yvw_zc2_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 46. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e3866">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e3869">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e3872">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e3866 ">None</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e3869 "> </td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e3872 "> </td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getDayOfWeek__table_zvw_zc2_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 47. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e3907">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e3910">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e3907 ">Number</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e3910 ">The day of the week value - Monday = 1, ... Sunday = 7.</td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime("2011-12-01 12:00:00"); gs.print(gdt.getDayOfWeek());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>4</code></pre> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-getDayOfWeekLocalTime"> <h2 class="title topictitle2" id="ariaid-title27">GlideDateTime - getDayOfWeekLocalTime()</h2> <div class="body refbody"><p class="shortdesc">Gets the day of the week stored by the GlideDateTime object, expressed in the user's time zone.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getDayOfWeekLocalTime__table_xmt_qd2_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 48. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e4002">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e4005">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e4008">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e4002 ">None</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e4005 "> </td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e4008 "> </td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getDayOfWeekLocalTime__table_ymt_qd2_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 49. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e4043">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e4046">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e4043 ">Number</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e4046 ">The day of the week value - Monday = 1, ... Sunday = 7</td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime("2011-12-01 12:00:00"); gs.print(gdt.getDayOfWeekLocalTime());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>4</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-getDayOfWeekLocalTime__section_lmp_k4r_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">getDayOfWeekLocalTime()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeGetDayOfWeekLocalTime" title="Gets the day of the week stored by the GlideDateTime object, expressed in the user's time zone.">getDayOfWeekLocalTime()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-getDayOfWeekUTC"> <h2 class="title topictitle2" id="ariaid-title28">GlideDateTime - getDayOfWeekUTC()</h2> <div class="body refbody"><p class="shortdesc">Gets the day of the week stored by the GlideDateTime object, expressed in the UTC time zone.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getDayOfWeekUTC__table_bwl_b22_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 50. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e4158">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e4161">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e4164">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e4158 ">None</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e4161 "> </td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e4164 "> </td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getDayOfWeekUTC__table_cwl_b22_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 51. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e4199">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e4202">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e4199 ">Number</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e4202 ">The day of the week value - Monday = 1, ... Sunday = 7</td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime("2011-12-01 12:00:00"); gs.print(gdt.getDayOfWeekUTC());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>4</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-getDayOfWeekUTC__section_ddt_n4r_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">getDayOfWeekUTC()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeGetDayOfWeekUTC" title="Returns the day of the week stored by the GlideDateTime object, expressed in the UTC time zone.">getDayOfWeekUTC()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-getDaysInMonth"> <h2 class="title topictitle2" id="ariaid-title29">GlideDateTime - getDaysInMonth()</h2> <div class="body refbody"><p class="shortdesc">Gets the number of days in the month stored by the GlideDateTime object, expressed in the Java Virtual Machine time zone.</p> <div class="section"> <p class="p">Use <span class="keyword apiname">getDaysInMonthLocalTime()</span> and <span class="keyword apiname">getDaysInMonthUTC()</span> instead of this method.</p> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getDaysInMonth__table_s3d_yj2_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 52. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e4322">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e4325">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e4328">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e4322 ">None</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e4325 "> </td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e4328 "> </td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getDaysInMonth__table_t3d_yj2_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 53. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e4363">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e4366">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e4363 ">Number</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e4366 ">The number of days in the current month in the Java Virtual Machine time zone.</td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime(); //December gs.print(gdt.getDaysInMonth());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>31</code></pre> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-getDaysInMonthLocalTime"> <h2 class="title topictitle2" id="ariaid-title30">GlideDateTime - getDaysInMonthLocalTime()</h2> <div class="body refbody"><p class="shortdesc">Gets the number of days in the month stored by the GlideDateTime object, expressed in the current user's time zone.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getDaysInMonthLocalTime__table_sjf_lk2_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 54. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e4459">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e4462">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e4465">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e4459 ">None</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e4462 "> </td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e4465 "> </td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getDaysInMonthLocalTime__table_tjf_lk2_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 55. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e4500">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e4503">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e4500 ">Number</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e4503 ">The number of days in the current month in the user's time zone.</td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime(); //December gs.print(gdt.getDaysInMonthLocalTime());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>31</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-getDaysInMonthLocalTime__section_z35_q4r_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">getDaysInMonthLocalTime()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeGetDaysInMonthLocalTime" title="Gets the number of days in the month stored by the GlideDateTime object, expressed in the current user's time zone.">getDaysInMonthLocalTime()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-getDaysInMonthUTC"> <h2 class="title topictitle2" id="ariaid-title31">GlideDateTime - getDaysInMonthUTC()</h2> <div class="body refbody"><p class="shortdesc">Gets the number of days in the month stored by the GlideDateTime object, expressed in the UTC time zone.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getDaysInMonthUTC__table_hwd_ll2_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 56. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e4614">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e4617">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e4620">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e4614 ">None</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e4617 "> </td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e4620 "> </td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getDaysInMonthUTC__table_iwd_ll2_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 57. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e4655">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e4658">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e4655 ">Number</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e4658 ">The number of days in the month stored by the GlideDateTime object, expressed in the UTC time zone.</td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime(); //December gs.print(gdt.getDaysInMonthUTC());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>31</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-getDaysInMonthUTC__section_l4t_54r_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">getDaysInMonthUTC()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeGetDaysInMonthUTC" title="Gets the number of days in the month stored by the GlideDateTime object, expressed in the UTC time zone.">getDaysInMonthUTC()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-getDisplayValue"> <h2 class="title topictitle2" id="ariaid-title32">GlideDateTime - getDisplayValue()</h2> <div class="body refbody"><p class="shortdesc">Gets the date and time value in the current user's display format and time zone.</p> <div class="section"> <div class="p"><div class="note"><span class="notetitle">Note:</span> Referring to the GlideDateTime object directly returns the date and time value in the GMT time zone.</div> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getDisplayValue__table_lyf_h1d_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 58. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e4774">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e4777">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e4780">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e4774 ">None</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e4777 "> </td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e4780 "> </td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getDisplayValue__table_myf_h1d_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 59. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e4815">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e4818">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e4815 ">Object</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e4818 ">Date and time in the user's format and time zone. Keep in mind when designing business rules or script includes that this method may return values in different formats for different users.</td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime("2011-08-31 08:00:00"); gs.info(gdt.getDisplayValue());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>2011-08-31 01:00:00</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-getDisplayValue__section_u2f_x4r_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">getDisplayValue()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeGetDisplayValue" title="Gets the date and time value in the current user's display format and time zone.">getDisplayValue()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-getDisplayValueInternal"> <h2 class="title topictitle2" id="ariaid-title33">GlideDateTime - getDisplayValueInternal()</h2> <div class="body refbody"><p class="shortdesc">Returns the display value in the internal format, yyyy-MM-dd HH:mm:ss. This method is useful for date/time fields, but not for date fields.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getDisplayValueInternal__table_ocw_t1d_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 60. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e4929">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e4932">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e4935">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e4929 ">None</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e4932 "> </td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e4935 "> </td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getDisplayValueInternal__table_pcw_t1d_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 61. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e4970">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e4973">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e4970 ">Object</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e4973 ">The date and time values for the GlideDateTime object.<p class="p">Format: yyyy-MM-dd HH:mm:ss in the caller's time zone.</p> </td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>// The passed in date and time is converted to the caller's time zone. var gdt = new GlideDateTime("2011-08-31 08:00:00"); gs.info(gdt.getDisplayValueInternal());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>2011-08-31 01:00:00</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-getDisplayValueInternal__section_jng_z4r_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">getDisplayValueInternal()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeGetDisplayValueInternal" title="Gets the display value in the internal format (yyyy-MM-dd HH:mm:ss).">getDisplayValueInternal()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-getDisplayValueLang_S"> <h2 class="title topictitle2" id="ariaid-title34">GlideDateTime - getDisplayValueLang(String style)</h2> <div class="body refbody"><p class="shortdesc">Returns a date and time value in the current user's locale according to the specified date style.</p> <div class="section" id="r_GDT-getDisplayValueLang_S__section_yqw_2mv_hvb"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getDisplayValueLang_S__id_zqf_hvw_dwb" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 62. </span>Parameters</span></caption><colgroup><col style="width:16.666666666666664%" /><col style="width:16.666666666666664%" /><col style="width:66.66666666666666%" /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e5087">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e5090">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e5093">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e5087 ">style</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e5090 ">String</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e5093 ">Specifies the date and time format. <div class="p">Valid values: <ul class="ul"><li class="li"><span class="keyword option">full</span>: returns the date in the format of <weekday, month, day, and year> according to the user's locale (for example, Monday, October 24, 2022).</li><li class="li"><span class="keyword option">long</span>: returns the date in the format of <month, day, and year> according to the user's locale (for example, October 24, 2022).</li><li class="li"><span class="keyword option">medium</span>: similar to <span class="ph uicontrol">long</span> but returns the date with an abbreviated month (for example, Oct 24, 2022).</li><li class="li"><span class="keyword option">short</span>: returns the date in the format of MM/DD/YY or DD/MM/YY according to the user's locale (for example, 10/24/2022 or 24/10/2022).</li></ul> </div> <p class="p">If any other value is passed the API will default to use <var class="keyword varname">medium</var>. Accepted values are not case sensitive.</p> </td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getDisplayValueLang_S__id_pp1_3vw_dwb" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 63. </span>Returns</span></caption><colgroup><col style="width:25%" /><col style="width:75%" /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e5163">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e5166">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e5163 ">String</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e5166 ">A string representation of the date in the style specified and in the appropriate format for the locale of the current user.</td></tr></tbody></table> </div> </div> <div class="example" id="r_GDT-getDisplayValueLang_S__id_f15_3vw_dwb"> <p class="p">The following example returns the date and time of the user's locale in all date styles.</p> <pre class="pre codeblock"><code>var gdt = new GlideDateTime(); // This will fetch the current date gs.info('date: ' + gdt.getDisplayValue()); gs.info('date: ' + gdt.getDisplayValueLang("full")); gs.info('date: ' + gdt.getDisplayValueLang("long")); gs.info('date: ' + gdt.getDisplayValueLang("medium")); gs.info('date: ' + gdt.getDisplayValueLang("short"));</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>date: 2023-01-18 06:49:02 date: Wednesday, January 18, 2023 06:49:02 date: January 18, 2023 06:49:02 date: Jan 18, 2023 06:49:02 date: 1/18/23 06:49:02</code></pre> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-getDisplayValueLang_S_S"> <h2 class="title topictitle2" id="ariaid-title35">GlideDateTime - getDisplayValueLang(String style, String language)</h2> <div class="body refbody"><p class="shortdesc">Returns a date and time value in the current user's locale according to a specified language and date style.</p> <div class="section" id="r_GDT-getDisplayValueLang_S_S__section_yqz_qqh_hvb"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getDisplayValueLang_S_S__id_dfb_4vw_dwb" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 64. </span>Parameters</span></caption><colgroup><col style="width:16.666666666666664%" /><col style="width:16.666666666666664%" /><col style="width:66.66666666666666%" /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e5261">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e5264">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e5267">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e5261 ">style</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e5264 ">String</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e5267 ">Specifies the date and time format. <div class="p">Valid values: <ul class="ul"><li class="li"><span class="keyword option">full</span>: returns the date in the format of <weekday, month, day, and year> according to the user's locale (for example, Monday, October 24, 2022).</li><li class="li"><span class="keyword option">long</span>: returns the date in the format of <month, day, and year> according to the user's locale (for example, October 24, 2022).</li><li class="li"><span class="keyword option">medium</span>: similar to <span class="ph uicontrol">long</span> but returns the date with an abbreviated month (for example, Oct 24, 2022).</li><li class="li"><span class="keyword option">short</span>: returns the date in the format of MM/DD/YY or DD/MM/YY according to the user's locale (for example, 10/24/2022 or 24/10/2022).</li></ul> </div> <p class="p">If any other value is passed the API will default to use <var class="keyword varname">medium</var>. Accepted values are not case sensitive.</p> </td></tr><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e5261 ">language</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e5264 ">String</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e5267 ">Returns the date according to a specified language value. Accepts language tags that conform with the BCP-47 standard. For example, <code class="ph codeph">fr</code> for French or <code class="ph codeph">en-UK</code> for British English. For a full list of accepted values, see <a class="xref" href="https://appmakers.dev/bcp-47-language-codes-list/" target="_blank" rel="noopener noreferrer">BCP 47 Language Code List</a>.</td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getDisplayValueLang_S_S__id_v5l_4vw_dwb" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 65. </span>Returns</span></caption><colgroup><col style="width:25%" /><col style="width:75%" /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e5359">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e5362">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e5359 ">String</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e5362 ">A string representation of the date in the style specified and in the appropriate format for the locale of the current user.</td></tr></tbody></table> </div> </div> <div class="example" id="r_GDT-getDisplayValueLang_S_S__id_sg4_pvw_dwb"> <p class="p">The following example returns the date and time of the user's locale in all language and date styles.</p> <pre class="pre codeblock"><code>var gdt = new GlideDateTime(); // This will fetch the current date gs.info('date: ' + gdt.getDisplayValue()); gs.info('date: ' + gdt.getDisplayValueLang("full", "fr")); gs.info('date: ' + gdt.getDisplayValueLang("long", "en-GB")); gs.info('date: ' + gdt.getDisplayValueLang("medium", "de")); gs.info('date: ' + gdt.getDisplayValueLang("short", "es-MX"));```</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>date: 2023-01-18 06:49:02 mercredi 18 janvier 2023 06:49:02 18 January 2023 06:49:02 18.01.2023 06:49:02 18/01/23 06:49:02</code></pre> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-getDSTOffset"> <h2 class="title topictitle2" id="ariaid-title36">GlideDateTime - getDSTOffset()</h2> <div class="body refbody"><p class="shortdesc">Gets the amount of time that daylight saving time is offset.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getDSTOffset__table_iyb_vvc_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 66. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e5458">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e5461">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e5464">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e5458 ">None</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e5461 "> </td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e5464 "> </td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getDSTOffset__table_jyb_vvc_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 67. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e5499">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e5502">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e5499 ">Number</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e5502 ">Amount of time, in milliseconds, that daylight saving is offset. Returns 0 if there is no offset or if the time is not during daylight saving time.</td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime("2011-08-31 08:00:00"); gs.print(gdt.getDSTOffset());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>3600000</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-getDSTOffset__section_myc_rnr_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">getDSTOffset()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeGetDSTOffset" title="Gets the amount of time that daylight saving time is offset.">getDSTOffset()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-getErrorMsg"> <h2 class="title topictitle2" id="ariaid-title37">GlideDateTime - getErrorMsg()</h2> <div class="body refbody"><p class="shortdesc">Gets the current error message.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getErrorMsg__table_dks_dsl_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 68. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e5613">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e5616">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e5619">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e5613 ">None</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e5616 "> </td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e5619 "> </td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getErrorMsg__table_eks_dsl_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 69. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e5654">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e5657">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e5654 ">Object</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e5657 ">The error message</td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime("2011-aa-31 aa:00:00"); //bad gs.print(gdt.isValid()); //false gs.print(gdt.getErrorMsg()); //reason</code></pre> <div class="p">Output: <pre class="pre codeblock"><code>false Could not parse DateTime: 2011-aa-31 aa:00:00</code></pre></div> </div> <div class="section scoped-equivalent" id="r_GDT-getErrorMsg__section_hmx_hpr_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">getErrorMsg()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeGetErrorMsg" title="Gets the current error message.">getErrorMsg()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-getInternalFormatedLocalTime"> <h2 class="title topictitle2" id="ariaid-title38">GlideDateTime - getInternalFormattedLocalTime()</h2> <div class="body refbody"><p class="shortdesc">Returns the object's time in the local time zone and in the internal format.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getInternalFormatedLocalTime__table_izw_h5c_kw" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 70. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e5768">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e5771">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e5774">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e5768 ">None</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e5771 "> </td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e5774 "> </td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getInternalFormatedLocalTime__table_jzw_h5c_kw" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 71. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e5809">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e5812">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e5809 ">Object</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e5812 ">The object's time in the local time zone and the internal format.</td></tr></tbody></table> </div> </div> <div class="example" id="r_GDT-getInternalFormatedLocalTime__example_p4j_4fh_m5b"> <p class="p">This example displays the time in the system time format of the user's timezone.</p> <pre class="pre codeblock"><code>var gdt = new GlideDateTime('2022-10-08 01:00:00'); gs.info(gdt.getDisplayValue()); gs.info(gdt.getInternalFormattedLocalTime());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>2022-10-07 06:00:00 PM 18:00:00</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-getInternalFormatedLocalTime__section_xvx_hc2_dbb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">getInternalFormattedLocalTime()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_SGDT-getInternalFormattedLocalTime" title="Returns the object's time in the local time zone and in the internal format.">getInternalFormattedLocalTime()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-getInternalMidnight_N"> <h2 class="title topictitle2" id="ariaid-title39">GlideDateTime - getInternalMidnight(Number dayOfTheWeek)</h2> <div class="body refbody"><p class="shortdesc">Returns a date and time object set to midnight of a specified day using UTC.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getInternalMidnight_N__table_llc_mp2_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 72. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e5926">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e5929">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e5932">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e5926 ">dayOfTheWeek</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e5929 ">Number</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e5932 ">The day of the week for which to return the date/time object.</td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getInternalMidnight_N__table_mlc_mp2_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 73. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e5969">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e5972">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e5969 ">GlideDateTime</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e5972 ">A GlideDateTime object set to midnight.</td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime("2011-08-31 08:00:00"); gs.print(gdt.getInternalMidnight(2));</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>2011-08-30 00:00:01</code></pre> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-getLocalDate"> <h2 class="title topictitle2" id="ariaid-title40">GlideDateTime - getLocalDate()</h2> <div class="body refbody"><p class="shortdesc">Gets the date stored by the GlideDateTime object, expressed in the standard format, yyyy-MM-dd, and the current user's time zone.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getLocalDate__table_ays_hr2_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 74. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e6065">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e6068">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e6071">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e6065 ">None</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e6068 "> </td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e6071 "> </td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getLocalDate__table_bys_hr2_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 75. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e6106">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e6109">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e6106 ">GlideDate</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e6109 ">The date in the user's time zone.</td></tr></tbody></table> </div> </div> <div class="example"> <p class="p">This example displays the time in the user's time format in the user's timezone.</p> <pre class="pre codeblock"><code>var gdt = new GlideDateTime("2011-08-31 08:00:00"); gs.print(gdt.getLocalDate());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>2011-08-31</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-getLocalDate__section_pg3_lpr_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">getLocalDate()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeGetLocalDate" title="Gets the date stored by the GlideDateTime object, expressed in the standard format, yyyy-MM-dd, and the current user's time zone.">getLocalDate()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-getLocalTime"> <h2 class="title topictitle2" id="ariaid-title41">GlideDateTime - getLocalTime()</h2> <div class="body refbody"><p class="shortdesc">Gets the time in the user's time zone.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getLocalTime__table_t11_4q2_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 76. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e6223">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e6226">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e6229">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e6223 ">None</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e6226 "> </td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e6229 "> </td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getLocalTime__table_u11_4q2_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 77. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e6264">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e6267">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e6264 ">GlideTime</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e6267 ">The time in the user's time zone.</td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime("2011-08-31 08:00:00"); gs.print(gdt.getLocalTime());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>1970-01-01 01:00:00</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-getLocalTime__section_kqj_4pr_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">getLocalTime()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeGetLocalTime" title="Returns a GlideTime object that represents the time portion of the GlideDateTime object in the user's time zone.">getLocalTime()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-getMonth"> <h2 class="title topictitle2" id="ariaid-title42">GlideDateTime - getMonth()</h2> <div class="body refbody"><p class="shortdesc">Retrieves the month stored by the GlideDateTime object, expressed in Java Virtual Machine time zone.</p> <div class="section"> <p class="p">Use <span class="keyword apiname">getMonthLocalTime()</span> and <span class="keyword apiname">getMonthUTC()</span> instead of this method.</p> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getMonth__table_pyx_tl2_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 78. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e6388">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e6391">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e6394">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e6388 ">None</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e6391 "> </td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e6394 "> </td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getMonth__table_qyx_tl2_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 79. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e6429">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e6432">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e6429 ">Number</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e6432 ">The numerical value of the month, Jan=1, Dec=12.</td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime(); //December gs.print(gdt.getMonth());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>12</code></pre> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-getMonthLocalTime"> <h2 class="title topictitle2" id="ariaid-title43">GlideDateTime - getMonthLocalTime()</h2> <div class="body refbody"><p class="shortdesc">Gets the month stored by the GlideDateTime object, expressed in the current user's time zone.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getMonthLocalTime__table_lcb_gm2_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 80. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e6524">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e6527">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e6530">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e6524 ">None</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e6527 "> </td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e6530 "> </td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getMonthLocalTime__table_mcb_gm2_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 81. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e6565">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e6568">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e6565 ">Number</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e6568 ">The numerical value of the month, Jan=1, Dec=12.</td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime(); //December gs.print(gdt.getMonthLocalTime());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>12</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-getMonthLocalTime__section_mts_pvr_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">getMonthLocalTime()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeGetMonthLocalTime" title="Gets the month stored by the GlideDateTime object, expressed in the current user's time zone.">getMonthLocalTime()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-getMonthUTC"> <h2 class="title topictitle2" id="ariaid-title44">GlideDateTime - getMonthUTC()</h2> <div class="body refbody"><p class="shortdesc">Gets the month stored by the GlideDateTime object, expressed in the UTC time zone.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getMonthUTC__table_bsp_5m2_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 82. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e6680">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e6683">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e6686">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e6680 ">None</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e6683 "> </td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e6686 "> </td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getMonthUTC__table_csp_5m2_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 83. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e6721">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e6724">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e6721 ">Number</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e6724 ">The numerical value of the month, Jan=1, Dec=12.</td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime(); //December gs.print(gdt.getMonthUTC());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>12</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-getMonthUTC__section_dvn_svr_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">getMonthUTC()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeGetMonthUTC" title="Gets the month stored by the GlideDateTime object, expressed in the UTC time zone.">getMonthUTC()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-getNumericValue"> <h2 class="title topictitle2" id="ariaid-title45">GlideDateTime - getNumericValue()</h2> <div class="body refbody"><p class="shortdesc">Gets the number of milliseconds since January 1, 1970, 00:00:00 GMT.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getNumericValue__table_vzg_g42_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 84. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e6835">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e6838">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e6841">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e6835 ">None</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e6838 "> </td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e6841 "> </td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getNumericValue__table_wzg_g42_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 85. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e6876">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e6879">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e6876 ">Number</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e6879 ">The number of milliseconds since January 1, 1970, 00:00:00 GMT.</td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime("2011-08-31 08:00:00"); gs.print(gdt.getNumericValue());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>1314777600000</code></pre> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-getSpanTime_N"> <h2 class="title topictitle2" id="ariaid-title46">GlideDateTime - getSpanTime(Number dayOfWeek)</h2> <div class="body refbody"><p class="shortdesc">Retrieves the amount of time elapsed since the midnight of a specified day to the current time.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getSpanTime_N__table_bqw_lf2_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 86. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e6972">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e6975">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e6978">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e6972 ">dayOfWeek</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e6975 ">Number</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e6978 ">Day of week value from 1 to 7. 1 = Monday, 7=Sunday.</td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getSpanTime_N__table_cqw_lf2_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 87. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e7015">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e7018">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e7015 ">GlideTime</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e7018 ">The amount of time elapsed since midnight of the specified day. To display the result in user-friendly terms, set the value to GlideDuration.</td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime("2011-08-31 08:00:00"); //Wednesday var dur = new GlideDuration(); var span = gdt.getSpanTime(1); //how much time since Monday 00:00:00 dur.setValue(span); gs.print(dur.getDisplayValue());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>2 Days 8 Hours</code></pre> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-getTime"> <h2 class="title topictitle2" id="ariaid-title47">GlideDateTime - getTime()</h2> <div class="body refbody"><p class="shortdesc">Gets the Unix duration stamp.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getTime__table_lny_z42_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 88. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e7110">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e7113">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e7116">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e7110 ">None</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e7113 "> </td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e7116 "> </td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getTime__table_mny_z42_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 89. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e7151">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e7154">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e7151 ">GlideTime</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e7154 ">The Unix duration stamp in system format based on GMT time.</td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime("2011-08-31 08:00:00"); gs.print(gdt.getTime());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>1970-01-01 08:00:00</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-getTime__section_fjc_xvr_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">getTime()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeGetTime" title="Returns a GlideTime object that represents the time portion of the GlideDateTime object.">getTime()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-getTZOffset"> <h2 class="title topictitle2" id="ariaid-title48">GlideDateTime - getTZOffset()</h2> <div class="body refbody"><p class="shortdesc">Gets the time zone offset in milliseconds.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getTZOffset__table_nk4_f5l_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 90. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e7266">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e7269">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e7272">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e7266 ">None</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e7269 "> </td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e7272 "> </td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getTZOffset__table_ok4_f5l_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 91. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e7307">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e7310">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e7307 ">Number</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e7310 ">The number of milliseconds of the time zone offset</td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime(); gdt.getLocalTime(); // PST local time gs.print(gdt.getTZOffset());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>-28800000</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-getTZOffset__section_ihs_5vr_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">getTZOffset()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeGetTZOffset" title="Gets the time zone offset in milliseconds.">getTZOffset()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-getUserFormattedLocalTime"> <h2 class="title topictitle2" id="ariaid-title49">GlideDateTime - getUserFormattedLocalTime()</h2> <div class="body refbody"><p class="shortdesc">Returns the object's time in local time zone in the user's format.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getUserFormattedLocalTime__table_lgj_ftc_kw" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 92. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e7421">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e7424">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e7427">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e7421 ">None</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e7424 "> </td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e7427 "> </td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getUserFormattedLocalTime__table_mgj_ftc_kw" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 93. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e7462">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e7465">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e7462 ">Object</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e7465 ">The object's time in local time and the user's format.</td></tr></tbody></table> </div> </div> <div class="example" id="r_GDT-getUserFormattedLocalTime__example_p4j_4fh_m5b"> <p class="p">The following code example shows how to call this method.</p> <pre class="pre codeblock"><code>var gdt = new GlideDateTime('2022-10-08 01:00:00'); gs.info(gdt.getDisplayValue()); gs.info(gdt.getUserFormattedLocalTime());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>2022-10-07 06:00:00 PM 06:00:00 PM</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-getUserFormattedLocalTime__section_hsv_f22_dbb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">getUserFormattedLocalTime()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_SGDT-getUserFormattedLocalTime" title="Returns the object's time in the local time zone and in the user's format.">getUserFormattedLocalTime()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-getUserTimeZone"> <h2 class="title topictitle2" id="ariaid-title50">GlideDateTime - getUserTimeZone()</h2> <div class="body refbody"><p class="shortdesc">Retrieves the time zone for the current user session.</p> <div class="section"> <p class="p">This method is equivalent to <code class="ph codeph">gs.getSession().getTimeZone()</code>.</p> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getUserTimeZone__table_eyw_b4c_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 94. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e7586">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e7589">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e7592">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e7586 ">None</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e7589 "> </td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e7592 "> </td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getUserTimeZone__table_fyw_b4c_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 95. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e7627">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e7630">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e7627 ">TimeZone</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e7630 ">TimeZone object for the current user.</td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime("2011-08-31 08:00:00"); gs.print(gdt.getUserTimeZone());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>sun.util.calendar.ZoneInfo[id="America/Los_Angeles",offset=-28800000,dstSavings=3600000,useDaylight=true,transitions=185, lastRule=java.util.SimpleTimeZone[id=America/Los_Angeles,offset=-28800000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3, startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1, endTime=7200000,endTimeMode=0]]</code></pre> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-getUTCMidnight_N"> <h2 class="title topictitle2" id="ariaid-title51">GlideDateTime - getUTCMidnight(Number dayOfTheWeek)</h2> <div class="body refbody"><p class="shortdesc">Retrieves a GlideDateTime object with the time set to midnight using the UTC time zone.</p> <div class="section"> <p class="p">This method sets the date of the new GlideDateTime object as the specified day of the week within the week of the original GlideDateTime object.</p> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getUTCMidnight_N__table_ezg_zp2_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 96. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e7725">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e7728">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e7731">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e7725 ">dayOfTheWeek</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e7728 ">Number</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e7731 ">The day of the week, from 1 to 7. Monday=1, Sunday=7. Do not enter 0 in this parameter.</td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getUTCMidnight_N__table_fzg_zp2_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 97. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e7768">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e7771">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e7768 ">GlideDateTime</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e7771 ">A new GlideDateTime object, set to midnight.</td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime("2011-08-31 08:00:00"); // Wednesday, 3rd day of the week. gs.print(gdt.getUTCMidnight(5)); //Friday, 5th day of the week.</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>2011-09-02 00:00:00</code></pre> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-getValue"> <h2 class="title topictitle2" id="ariaid-title52">GlideDateTime - getValue()</h2> <div class="body refbody"><p class="shortdesc">Returns the date and time value stored by the GlideDateTime object in the internal format, yyyy-MM-dd HH:mm:ss, in the UTC time zone.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getValue__table_osc_gbd_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 98. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e7864">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e7867">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e7870">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e7864 ">None</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e7867 "> </td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e7870 "> </td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getValue__table_psc_gbd_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 99. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e7905">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e7908">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e7905 ">String</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e7908 ">Date and time in the internal format and system time zone.<p class="p">Format: yyyy-MM-dd HH:mm:ss in the UTC time zone.</p> </td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime("2011-08-31 08:00:00"); gs.info(gdt.getValue());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>2011-08-31 08:00:00</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-getValue__section_kt5_zvr_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">getValue()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeGetValue" title="Returns the date and time value stored by the GlideDateTime object in the internal format, yyyy-MM-dd HH:mm:ss, in the UTC time zone.">getValue()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-getWeekOfYearLocalTime"> <h2 class="title topictitle2" id="ariaid-title53">GlideDateTime - getWeekOfYearLocalTime()</h2> <div class="body refbody"><p class="shortdesc">Gets the number of the week stored by the GlideDateTime object, expressed in the current user's time zone.</p> <div class="section"> <p class="p">All weeks begin on Sunday. The first week of the year is the week that contains at least one day of the new year. The week beginning Sunday 2015-12-27 is considered the first week of 2016 as that week contains January 1 and 2.</p> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getWeekOfYearLocalTime__table_vq5_422_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 100. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e8024">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e8027">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e8030">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e8024 ">None</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e8027 "> </td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e8030 "> </td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getWeekOfYearLocalTime__table_wq5_422_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 101. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e8065">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e8068">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e8065 ">Number</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e8068 ">The number of the current week. The highest week number in a year is either 52 or 53.</td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime("2011-12-01 12:00:00"); gs.print(gdt.getWeekOfYearUTC());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>49</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-getWeekOfYearLocalTime__section_yh2_cwr_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">getWeekOfYearLocalTime()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeGetWeekOfYearLocalTime" title="Gets the number of the week stored by the GlideDateTime object, expressed in the current user's time zone.">getWeekOfYearLocalTime()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-getWeekOfYearUTC"> <h2 class="title topictitle2" id="ariaid-title54">GlideDateTime - getWeekOfYearUTC()</h2> <div class="body refbody"><p class="shortdesc">Gets the number of the week stored by the GlideDateTime object, expressed in the UTC time zone.</p> <div class="section"> <p class="p">All weeks begin on Sunday. The first week of the year is the week that contains at least one day of the new year. The week beginning Sunday 2015-12-27 is considered the first week of 2016 as that week contains January 1 and 2.</p> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getWeekOfYearUTC__table_jdh_bf2_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 102. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e8183">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e8186">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e8189">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e8183 ">None</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e8186 "> </td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e8189 "> </td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getWeekOfYearUTC__table_kdh_bf2_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 103. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e8224">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e8227">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e8224 ">Number</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e8227 ">The number of the current week in UTC time. The highest week number in a year is either 52 or 53.</td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime("2011-12-01 12:00:00"); gs.print(gdt.getWeekOfYearUTC());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>49</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-getWeekOfYearUTC__section_fpl_2wr_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">getWeekOfYearUTC()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeGetWeekOfYearUTC" title="Gets the number of the week stored by the GlideDateTime object, expressed in the UTC time zone.">getWeekOfYearUTC()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-getYear"> <h2 class="title topictitle2" id="ariaid-title55">GlideDateTime - getYear()</h2> <div class="body refbody"><p class="shortdesc">Retrieves the year stored by the GlideDateTime object, expressed in the Java Virtual Machine time zone.</p> <div class="section"> <p class="p">Use <span class="keyword apiname">getYearLocalTime()</span> and <span class="keyword apiname">getYearUTC()</span> instead of this method.</p> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getYear__table_jhh_dn2_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 104. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e8347">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e8350">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e8353">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e8347 ">None</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e8350 "> </td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e8353 "> </td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getYear__table_khh_dn2_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 105. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e8388">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e8391">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e8388 ">Number</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e8391 ">The 4-digit year value in the Java Virtual Machine time zone.</td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime(); //2011 gs.print(gdt.getYear());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>2011</code></pre> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-getYearLocalTime"> <h2 class="title topictitle2" id="ariaid-title56">GlideDateTime - getYearLocalTime()</h2> <div class="body refbody"><p class="shortdesc">Gets the year stored by the GlideDateTime object, expressed in the current user's time zone.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getYearLocalTime__table_tzz_4n2_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 106. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e8484">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e8487">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e8490">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e8484 ">None</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e8487 "> </td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e8490 "> </td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getYearLocalTime__table_uzz_4n2_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 107. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e8525">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e8528">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e8525 ">Number</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e8528 ">The 4-digit year value in the user's time zone.</td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime(); //2011 gs.print(gdt.getYearLocalTime());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>2011</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-getYearLocalTime__section_dys_jwr_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">getYearLocalTime()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeGetYearLocalTime" title="Gets the year stored by the GlideDateTime object, expressed in the current user's time zone.">getYearLocalTime()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-getYearUTC"> <h2 class="title topictitle2" id="ariaid-title57">GlideDateTime - getYearUTC()</h2> <div class="body refbody"><p class="shortdesc">Returns the year stored by the GlideDateTime object, expressed in the UTC time zone.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getYearUTC__table_dml_xn2_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 108. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e8639">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e8642">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e8645">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e8639 ">None</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e8642 "> </td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e8645 "> </td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-getYearUTC__table_eml_xn2_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 109. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e8680">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e8683">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e8680 ">number</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e8683 ">Four-digit year value in the UTC time zone.</td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime(); //2011 gs.info(gdt.getYearUTC());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>2011</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-getYearUTC__section_j4m_pwr_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">getYearUTC()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeGetYearUTC" title="Gets the year stored by the GlideDateTime object, expressed in the UTC time zone.">getYearUTC()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-hasDate"> <h2 class="title topictitle2" id="ariaid-title58">GlideDateTime - hasDate()</h2> <div class="body refbody"><p class="shortdesc">Determines if an object's date is set.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-hasDate__table_iqj_rnc_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 110. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e8795">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e8798">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e8801">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e8795 ">None</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e8798 "> </td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e8801 "> </td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-hasDate__table_jqj_rnc_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 111. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e8836">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e8839">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e8836 ">Boolean</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e8839 ">True if the object's date is set, false otherwise.</td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime("2011-08-31 08:00:00"); gs.print(gdt.hasDate());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>true</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-hasDate__section_yzp_rwr_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">hasDate()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeHasDate" title="Determines if an object's date is set.">hasDate()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-isDST"> <h2 class="title topictitle2" id="ariaid-title59">GlideDateTime - isDST()</h2> <div class="body refbody"><p class="shortdesc">Determines if the object's time uses a daylight saving offset</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-isDST__table_ncy_jvc_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 112. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e8950">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e8953">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e8956">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e8950 ">None</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e8953 "> </td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e8956 "> </td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-isDST__table_ocy_jvc_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 113. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e8991">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e8994">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e8991 ">Boolean</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e8994 ">True if the time is daylight saving time, false otherwise.</td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime("2011-08-31 00:00:00"); gs.print(gdt.isDST()); //true</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>true</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-isDST__section_gns_twr_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">isDST()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeIsDST" title="Determines if an object's time uses a daylight saving offset.">isDST()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-isValid"> <h2 class="title topictitle2" id="ariaid-title60">GlideDateTime - isValid()</h2> <div class="body refbody"><p class="shortdesc">Determines if a value is a valid date and time.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-isValid__table_sfh_5rl_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 114. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e9106">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e9109">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e9112">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e9106 ">None</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e9109 "> </td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e9112 "> </td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-isValid__table_tfh_5rl_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 115. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e9147">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e9150">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e9147 ">Boolean</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e9150 ">True if value is valid, false otherwise.</td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime("2011-aa-31 aa:00:00"); gs.print(gdt.isValid()); //true gs.print(gdt.getErrorMsg()); //reason</code></pre> <p class="p">Output</p> <pre class="pre codeblock"><code>Invalid date time: '2011-aa-31 aa:00:00', ignored</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-isValid__section_flp_vwr_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">isValid()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeIsValid" title="Determines if a value is a valid date and time.">isValid()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-setDayOfMonth_N"> <h2 class="title topictitle2" id="ariaid-title61">GlideDateTime - setDayOfMonth(Number day)</h2> <div class="body refbody"><p class="shortdesc">Sets the day of the month to a specified value.</p> <div class="section"> <p class="p">Use <span class="keyword apiname">setDayOfMonthLocalTime(day)</span> and <span class="keyword apiname">setDayOfMonthUTC(day)</span> instead of this method.</p> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-setDayOfMonth_N__table_pp4_vh2_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 116. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e9270">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e9273">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e9276">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e9270 ">day</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e9273 ">Number</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e9276 ">Day of the month, from 1 to 31.</td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-setDayOfMonth_N__table_qp4_vh2_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 117. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e9313">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e9316">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e9313 ">void</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e9316 "> </td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime(); gdt.setDayOfMonth(9); gs.print(gdt.getDayOfMonth());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>9</code></pre> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-setDayOfMonthLocalTime_N"> <h2 class="title topictitle2" id="ariaid-title62">GlideDateTime - setDayOfMonthLocalTime(Number day)</h2> <div class="body refbody"><p class="shortdesc">Sets the day of the month to a specified value in the current user's time zone.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-setDayOfMonthLocalTime_N__table_bvc_1j2_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 118. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e9408">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e9411">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e9414">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e9408 ">day</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e9411 ">Number</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e9414 ">The day of month to change to, from 1 to 31. If this value is greater than the maximum number of days in the month, the value is set to the last day of the month.</td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-setDayOfMonthLocalTime_N__table_cvc_1j2_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 119. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e9451">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e9454">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e9451 ">void</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e9454 "> </td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime(); gdt.setDayOfMonthLocalTime(9); gs.print(gdt.getDayOfMonthLocalTime());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>9</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-setDayOfMonthLocalTime_N__section_p4c_ywr_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">setDayOfMonthLocalTime()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeSetDayOfMonthLocalTime_Number_day" title="Sets the day of the month to a specified value in the current user's time zone.">setDayOfMonthLocalTime()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-setDayOfMonthUTC_N"> <h2 class="title topictitle2" id="ariaid-title63">GlideDateTime - setDayOfMonthUTC(Number day)</h2> <div class="body refbody"><p class="shortdesc">Sets the day of the month to a specified value in the UTC time zone.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-setDayOfMonthUTC_N__table_mmk_mj2_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 120. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e9564">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e9567">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e9570">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e9564 ">day</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e9567 ">Number</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e9570 ">The day of month to change to, from 1 to 31. If this value is greater than the maximum number of days in the month, the value is set to the last day of the month.</td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-setDayOfMonthUTC_N__table_nmk_mj2_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 121. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e9607">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e9610">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e9607 ">void</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e9610 "> </td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime(); gdt.setDayOfMonthUTC(9); gs.print(gdt.getDayOfMonthUTC());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>9</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-setDayOfMonthUTC_N__section_rxh_1xr_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">setDayOfMonthUTC()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeSetDayOfMonthUTC_Number_day" title="Sets the day of the month to a specified value in the UTC time zone.">setDayOfMonthUTC()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-setDisplayValue_S"> <h2 class="title topictitle2" id="ariaid-title64">GlideDateTime - setDisplayValue(String asDisplayed)</h2> <div class="body refbody"><p class="shortdesc">Sets a date and time value using the current user's display format and time zone.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-setDisplayValue_S__table_jnc_fwc_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 122. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e9721">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e9724">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e9727">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e9721 ">asDisplayed</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e9724 ">String</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e9727 ">The date and time in the current user's display format and time zone. The parameter must be formatted using the current user's preferred display format, such as MM-dd-yyyy HH:mm:ss. To assign the current date and time to a variable in a workflow script, use <code class="ph codeph"><variable>.setDisplayValue(gs.nowDateTime);</code>.</td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-setDisplayValue_S__table_knc_fwc_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 123. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e9767">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e9770">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e9767 ">void</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e9770 "> </td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime("2011-02-02 12:00:00"); gdt.setDisplayValue("2011-01-01 12:00:00"); gs.print(gdt.getValue());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>2011-01-01 20:00:00</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-setDisplayValue_S__section_wyq_2xr_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">setDisplayValue()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeSetDisplayValue_String_asDisplayed" title="Sets a date and time value using the current user's display format and time zone.">setDisplayValue()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-setDisplayValue_S_S"> <h2 class="title topictitle2" id="ariaid-title65">GlideDateTime - setDisplayValue(String dateTime, String format)</h2> <div class="body refbody"><p class="shortdesc">Sets a date and time value using the current user's time zone and the specified date and time format.</p> <div class="section"> <p class="p">This method throws a runtime exception if the date and time format used in the dateTime parameter does not match the format parameter. You can retrieve the error message by calling <span class="keyword apiname">getErrorMsg()</span> on the GlideDateTime object after the exception is caught.</p> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-setDisplayValue_S_S__table_dqz_pzc_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 124. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e9886">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e9889">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e9892">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e9886 ">dateTime</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e9889 ">String</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e9892 ">The date and time in the current user's time zone.</td></tr><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e9886 ">format</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e9889 ">String</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e9892 ">The format to use to parse the dateTime parameter.</td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-setDisplayValue_S_S__table_eqz_pzc_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 125. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e9941">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e9944">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e9941 ">void</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e9944 "> </td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime("2011-02-02 12:00:00"); gdt.setDisplayValue("20-5-2011 12:00:00", "dd-MM-yyyy HH:mm:ss"); gs.print(gdt.getValue());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>2011-05-20 19:00:00</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-setDisplayValue_S_S__section_zns_gxr_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">setDisplayValue()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeSetDisplayValue_String_value_String_format" title="Sets a date and time value using the current user's time zone and the specified date and time format.">setDisplayValue()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-setDisplayValueInternal_S"> <h2 class="title topictitle2" id="ariaid-title66">GlideDateTime - setDisplayValueInternal(String dateTime)</h2> <div class="body refbody"><p class="shortdesc">Sets a date and time value using the internal format (yyyy-MM-dd HH:mm:ss) and the current user's time zone.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-setDisplayValueInternal_S__table_zrg_5wc_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 126. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e10055">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e10058">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e10061">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e10055 ">dateTime</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e10058 ">String</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e10061 ">The date and time in internal format</td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-setDisplayValueInternal_S__table_asg_5wc_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 127. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e10098">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e10101">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e10098 ">void</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e10101 "> </td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime("2011-02-02 12:00:00"); gdt.setDisplayValueInternal("2011-01-01 12:00:00"); gs.print(gdt.getValue());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>2011-01-01 20:00:00</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-setDisplayValueInternal_S__section_hrc_cxr_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">setDisplayValueInternal()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeSetDisplayValueInternal_String_value" title="Sets a date and time value using the internal format (yyyy-MM-dd HH:mm:ss) and the current user's time zone.">setDisplayValueInternal()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-setDispValInternalAlt_S"> <h2 class="title topictitle2" id="ariaid-title67">GlideDateTime - setDisplayValueInternalWithAlternates(String dateTime)</h2> <div class="body refbody"><p class="shortdesc">Sets a date and time value using the internal format (yyyy-MM-dd HH:mm:ss) and the current user's time zone.</p> <div class="section"> <p class="p">This method attempts to parse incomplete date and time values.</p> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-setDispValInternalAlt_S__table_ipl_dzc_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 128. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e10214">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e10217">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e10220">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e10214 ">dateTime</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e10217 ">String</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e10220 ">The date and time in internal format.</td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-setDispValInternalAlt_S__table_jpl_dzc_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 129. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e10257">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e10260">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e10257 ">void</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e10260 "> </td></tr></tbody></table> </div> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-setDisplayValueLang_S_S"> <h2 class="title topictitle2" id="ariaid-title68">GlideDateTime - setDisplayValueLang(String dateTime, String style)</h2> <div class="body refbody"><p class="shortdesc">Sets a date using a specified style and format according to the current user's locale.</p> <div class="section" id="r_GDT-setDisplayValueLang_S_S__section_yqz_qqh_hvb"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-setDisplayValueLang_S_S__id_jjl_xvw_dwb" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 130. </span>Parameters</span></caption><colgroup><col style="width:16.666666666666664%" /><col style="width:16.666666666666664%" /><col style="width:66.66666666666666%" /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e10340">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e10343">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e10346">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e10340 ">dateTime</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e10343 ">String</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e10346 ">Date and time value for the GlideDate object in the current user's time zone. Valid values are any date and time output from the <span class="keyword apiname">getDisplayValueLang()</span> function.<p class="p">For instance, using output from the <span class="keyword apiname">getDisplayValueLang(String style, String language)</span> example earlier in this topic, <span class="ph uicontrol">November 28, 2022 07:03:41</span> or <span class="ph uicontrol">28.11.2022 07:03:41</span> are accepted values.</p> </td></tr><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e10340 ">style</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e10343 ">String</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e10346 ">Specifies the date format. <div class="p">Valid values: <ul class="ul"><li class="li"><span class="keyword option">full</span>: returns the date in the format of <weekday, month, day, and year> according to the user's locale (for example, Monday, October 24, 2022).</li><li class="li"><span class="keyword option">long</span>: returns the date in the format of <month, day, and year> according to the user's locale (for example, October 24, 2022).</li><li class="li"><span class="keyword option">medium</span>: similar to <span class="ph uicontrol">long</span> but returns the date with an abbreviated month (for example, Oct 24, 2022).</li><li class="li"><span class="keyword option">short</span>: returns the date in the format of MM/DD/YY or DD/MM/YY according to the user's locale (for example, 10/24/2022 or 24/10/2022).</li></ul> </div> <p class="p">If any other value is passed the API will default to use <var class="keyword varname">medium</var>. Accepted values are not case sensitive.</p> </td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-setDisplayValueLang_S_S__id_e41_yvw_dwb" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 131. </span>Returns</span></caption><colgroup><col style="width:25%" /><col style="width:75%" /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e10442">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e10445">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e10442 ">Void</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e10445 "> </td></tr></tbody></table> </div> </div> <div class="example" id="r_GDT-setDisplayValueLang_S_S__id_y4y_v4t_gwb"> <p class="p">The following example returns the date and time in short and full styles.</p> <pre class="pre codeblock"><code>var glideDateFR = new GlideDateTime(); glideDateFR.setDisplayValueLang("2/3/2023 17:27:56", "short"); gs.info('date: ' + glideDateFR.getDisplayValue()); gs.info('date: ' + glideDateFR.getDisplayValueLang("full"));</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>date: 2023-02-03 17:27:56 date: Friday, February 3, 2023 17:27:56</code></pre> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-setDisplayValueLang_S_S_S"> <h2 class="title topictitle2" id="ariaid-title69">GlideDateTime - setDisplayValueLang(String dateTime, String style, String language)</h2> <div class="body refbody"><p class="shortdesc">Sets a date and time using a specified style, language, and format according to the current user's locale.</p> <div class="section" id="r_GDT-setDisplayValueLang_S_S_S__section_ddw_l4n_hvb"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-setDisplayValueLang_S_S_S__id_zks_2ww_dwb" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 132. </span>Parameters</span></caption><colgroup><col style="width:16.666666666666664%" /><col style="width:16.666666666666664%" /><col style="width:66.66666666666666%" /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e10539">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e10542">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e10545">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e10539 ">dateTime</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e10542 ">String</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e10545 ">Date and time value for the GlideDate object in the current user's time zone. Valid values are any date and time output from the <span class="keyword apiname">getDisplayValueLang()</span> function.<p class="p">For instance, using output from the <span class="keyword apiname">getDisplayValueLang(String style, String language)</span> example earlier in this topic, <span class="ph uicontrol">November 28, 2022 07:03:41</span> or <span class="ph uicontrol">28.11.2022 07:03:41</span> are accepted values.</p> </td></tr><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e10539 ">style</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e10542 ">String</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e10545 ">Specifies the date format. <div class="p">Valid values: <ul class="ul"><li class="li"><span class="keyword option">full</span>: returns the date in the format of <weekday, month, day, and year> according to the user's locale (for example, Monday, October 24, 2022).</li><li class="li"><span class="keyword option">long</span>: returns the date in the format of <month, day, and year> according to the user's locale (for example, October 24, 2022).</li><li class="li"><span class="keyword option">medium</span>: similar to <span class="ph uicontrol">long</span> but returns the date with an abbreviated month (for example, Oct 24, 2022).</li><li class="li"><span class="keyword option">short</span>: returns the date in the format of MM/DD/YY or DD/MM/YY according to the user's locale (for example, 10/24/2022 or 24/10/2022).</li></ul> </div> <p class="p">If any other value is passed the API will default to use <var class="keyword varname">medium</var>. Accepted values are not case sensitive.</p> </td></tr><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e10539 ">language</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e10542 ">String</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e10545 ">Sets the language using a language tag that conforms with the BCP-47 standard. For example, <code class="ph codeph">fr</code> for French or <code class="ph codeph">en-UK</code> for British English. For a full list of accepted values, see <a class="xref" href="https://appmakers.dev/bcp-47-language-codes-list/" target="_blank" rel="noopener noreferrer">BCP 47 Language Code List</a>.</td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-setDisplayValueLang_S_S_S__id_rg3_fww_dwb" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 133. </span>Returns</span></caption><colgroup><col style="width:25%" /><col style="width:75%" /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e10663">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e10666">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e10663 ">Void</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e10666 "> </td></tr></tbody></table> </div> </div> <div class="example" id="r_GDT-setDisplayValueLang_S_S_S__id_uzg_x4t_gwb"> <p class="p">The following example returns the date and time in short and full styles for English and French.</p> <pre class="pre codeblock"><code>var glideDateFR = new GlideDateTime(); glideDateUS.setDisplayValueLang("2/3/2023 18:00:00", "short", "en-US" ); glideDateFR.setDisplayValueLang("2/3/2023 18:00:00", "short", "fr-FR" ); gs.info('en-US date: ' + glideDateUS.getDisplayValue()); gs.info('en-US date: ' + glideDateUS.getDisplayValueLang("full")); gs.info('fr-FR date: ' + glideDateFR.getDisplayValue()); gs.info('fr-FR date: ' + glideDateFR.getDisplayValueLang("full"));</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>en-US date: 2023-02-03 18:00:00 en-US date: Friday, February 3, 2023 18:00:00 fr-FR date: 2023-03-02 18:00:00 fr-FR date: Thursday, March 2, 2023 18:00:00</code></pre> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-setGlideDateTime_GDT"> <h2 class="title topictitle2" id="ariaid-title70">GlideDateTime - setGlideDateTime(GlideDateTime gDT)</h2> <div class="body refbody"><p class="shortdesc">Sets the date and time of the current object using an existing GlideDateTime object.</p> <div class="section"> <p class="p">This method is equivalent to instantiating a new object with a GlideDateTime parameter.</p> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-setGlideDateTime_GDT__table_xdg_y5c_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 134. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e10764">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e10767">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e10770">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e10764 ">gDT</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e10767 ">GlideDateTime</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e10770 ">A GlideDateTime object</td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-setGlideDateTime_GDT__table_ydg_y5c_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 135. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e10807">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e10810">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e10807 ">void</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e10810 "> </td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var dt1 = new GlideDateTime("2011-01-01 12:00:00"); var dt2 = new GlideDateTime("2011-02-02 08:00:00"); dt1.setGlideDateTime(dt2); gs.print(dt1.getValue());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>2011-02-02 08:00:00</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-setGlideDateTime_GDT__section_fjw_3xr_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">setGlideDateTime()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeSetGlideDateTime_g" title="Sets the date and time of the current object using an existing GlideDateTime object. This method is equivalent to instantiating a new object with a GlideDateTime parameter.">setGlideDateTime()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-setInitialValue_S"> <h2 class="title topictitle2" id="ariaid-title71">GlideDateTime - setInitialValue(String dateTime)</h2> <div class="body refbody"><p class="shortdesc">Sets the date and time.</p> <div class="section"> <p class="p">This method is equivalent to <span class="keyword apiname">setValue(Object)</span>.</p> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-setInitialValue_S__table_i42_r5l_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 136. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e10926">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e10929">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e10932">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e10926 ">dateTime</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e10929 ">String</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e10932 ">The date and time to use. Accepts either a string in the GMT time zone in the internal format, or a GlideDateTime object.</td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-setInitialValue_S__table_j42_r5l_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 137. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e10969">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e10972">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e10969 ">void</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e10972 "> </td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime(); gdt.setInitialValue("2011-01-01 12:00:00"); gs.print(gdt.getValue());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>2011-01-01 12:00:00</code></pre> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-setMonth_N"> <h2 class="title topictitle2" id="ariaid-title72">GlideDateTime - setMonth(Number month)</h2> <div class="body refbody"><p class="shortdesc">Sets the month stored by the GlideDateTime object to a specified value using the Java Virtual Machine time zone.</p> <div class="section"> <p class="p">Use <span class="keyword apiname">setMonthLocalTime()</span> or <span class="keyword apiname">setMonthUTC()</span> instead of this method.</p> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-setMonth_N__table_djd_3wl_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 138. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e11073">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e11076">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e11079">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e11073 ">month</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e11076 ">Number</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e11079 ">The month to change to.</td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-setMonth_N__table_ejd_3wl_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 139. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e11116">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e11119">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e11116 ">void</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e11119 "> </td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime(); gdt.setMonth(1); gs.print(gdt.getMonth());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>1</code></pre> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-setMonthLocalTime_N"> <h2 class="title topictitle2" id="ariaid-title73">GlideDateTime - setMonthLocalTime(Number month)</h2> <div class="body refbody"><p class="shortdesc">Sets the month stored by the GlideDateTime object to a specified value using the current user's time zone.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-setMonthLocalTime_N__table_xgm_wwl_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 140. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e11210">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e11213">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e11216">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e11210 ">month</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e11213 ">Number</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e11216 ">The month to change to.</td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-setMonthLocalTime_N__table_ygm_wwl_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 141. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e11253">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e11256">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e11253 ">void</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e11256 "> </td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime(); gdt.setMonthLocalTime(1); gs.print(gdt.getMonthLocalTime());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>1</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-setMonthLocalTime_N__section_rqq_lxr_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">setMonthLocalTime()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeSetMonthLocalTime_Number" title="Sets the month stored by the GlideDateTime object to the specified value using the current user's time zone.">setMonthLocalTime()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-setMonthUTC_N"> <h2 class="title topictitle2" id="ariaid-title74">GlideDateTime - setMonthUTC(Number month)</h2> <div class="body refbody"><p class="shortdesc">Sets the month stored by the GlideDateTime object to a specified value using the UTC time zone.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-setMonthUTC_N__table_gt5_fxl_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 142. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e11367">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e11370">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e11373">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e11367 ">month</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e11370 ">Number</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e11373 ">The month to change to.</td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-setMonthUTC_N__table_ht5_fxl_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 143. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e11410">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e11413">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e11410 ">void</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e11413 "> </td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime(); gdt.setMonthUTC(1); gs.print(gdt.getMonthUTC());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>1</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-setMonthUTC_N__section_xyx_nxr_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">setMonthUTC()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeSetMonthUTC_Number" title="Sets the month stored by the GlideDateTime object to the specified value using the UTC time zone.">setMonthUTC()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-setNumericValue_N"> <h2 class="title topictitle2" id="ariaid-title75">GlideDateTime - setNumericValue(Number milliseconds)</h2> <div class="body refbody"><p class="shortdesc">Sets the date and time to the number of milliseconds since January 1, 1970 00:00:00 GMT.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-setNumericValue_N__table_jsf_q42_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 144. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e11523">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e11526">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e11529">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e11523 ">milliseconds</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e11526 ">Number</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e11529 ">Number of milliseconds</td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-setNumericValue_N__table_ksf_q42_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 145. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e11566">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e11569">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e11566 ">void</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e11569 "> </td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime(); gdt.setNumericValue(1314777600000); gs.print(gdt.getValue());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>2011-08-31 08:00:00</code></pre> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-setTZ_TZ"> <h2 class="title topictitle2" id="ariaid-title76">GlideDateTime - setTZ(TimeZone timeZone)</h2> <div class="body refbody"><p class="shortdesc">Sets the time zone of the GlideDateTime object to be the specified time zone.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-setTZ_TZ__table_uy3_54c_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 146. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e11661">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e11664">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e11667">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e11661 ">timeZone</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e11664 ">TimeZone</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e11667 ">A time zone object</td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-setTZ_TZ__table_vy3_54c_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 147. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e11704">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e11707">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e11704 ">void</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e11707 "> </td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var tz = gs.getSession().getTimeZone(); var gdt = new GlideDateTime(); gdt.setTZ(tz);</code></pre> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-setValue_O"> <h2 class="title topictitle2" id="ariaid-title77">GlideDateTime - setValue(Object dateTime)</h2> <div class="body refbody"><p class="shortdesc">Sets the date and time of the GlideDateTime object.</p> <div class="section"> <p class="p">This method is equivalent to <span class="keyword apiname">setInitialValue()</span>.</p> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-setValue_O__table_yfh_fpc_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 148. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e11798">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e11801">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e11804">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e11798 ">dateTime</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e11801 ">Object</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e11804 ">The date and time to use. This parameter may be one of several types. <ul class="ul" id="r_GDT-setValue_O__ul_j3h_4pc_nt"><li class="li">A string in the UTC time zone and the internal format of yyyy-MM-dd HH:mm:ss: Sets the value of the object to the specified date and time. Using the method this way is equivalent to instantiating a new GlideDateTime object using the <span class="keyword apiname">GlideDateTime(value)</span> constructor. If the date and time format used does not match the internal format, the method attempts to set the date and time using other available formats. Resolving the date and time this way can lead to inaccurate data due to ambiguity in the day and month values. When using a non-standard date and time format, use <span class="keyword apiname">setValueUTC(dateTime, format)</span> instead.</li><li class="li">A GlideDateTime object: Sets the value of the object to the date and time stored by the GlideDateTime passed in the parameter. Using the method this way is equivalent to instantiating a new GlideDateTime object using the <span class="keyword apiname">GlideDateTime(g)</span> constructor.</li><li class="li">A Java Date object: Sets the value of the object using the value stored by the Java Date object. Using the method this way is equivalent to passing the value returned by the Java Date object <span class="keyword apiname">getTime()</span> to the GlideDateTime <span class="keyword apiname">setNumericValue()</span> method. This method does not accept JavaScript Date objects.</li><li class="li">A JavaScript Number: Sets the value of the object using the Number value as milliseconds past January 1, 1970 00:00:00 UTC. Using the method this way is equivalent to the <span class="keyword apiname">setNumericValue(milliseconds)</span> method.</li><li class="li">A Java Integer or Long: Sets the value of the object using the Integer or Long value as milliseconds past January 1, 1970 00:00:00 UTC. Using the method this way is equivalent to the <span class="keyword apiname">setNumericValue(milliseconds)</span> method.</li></ul> </td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-setValue_O__table_zfh_fpc_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 149. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e11879">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e11882">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e11879 ">void</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e11882 "> </td></tr></tbody></table> </div> </div> <div class="example" id="r_GDT-setValue_O__example_rtg_4kr_2pb"> <p class="p">Set the date and time using a string in yyyy-MM-dd HH:mm:ss format.</p> <pre class="pre codeblock"><code>var gdt = new GlideDateTime("2011-01-01 12:00:00"); gdt.setValue("2011-02-02 08:00:00"); gs.print(gdt.getValue());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>2011-02-02 08:00:00</code></pre> </div> <div class="example" id="r_GDT-setValue_O__example_otv_tjr_2pb"> <p class="p">Set the date and time using an existing GlideDateTime object.</p> <pre class="pre codeblock"><code>var gdtSource = new GlideDateTime("2017-05-23 11:37:41"); var gdtDest = new GlideDateTime(); gdtDest.setValue(gdtSource); gs.print(gdtDest.getValue());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>2017-05-23 11:37:41</code></pre> </div> <div class="example" id="r_GDT-setValue_O__example_hcz_dkr_2pb"> <p class="p">Set the date and time using a number indicating milliseconds past January 1, 1970 00:00:00 UTC.</p> <pre class="pre codeblock"><code>var gdt = new GlideDateTime("2011-01-01 12:00:00"); gdt.setValue(1617634522375); gs.print(gdt.getValue());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>2021-04-05 14:55:22</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-setValue_O__section_w2m_sxr_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">setValue()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeSetValue_String_o" title="Sets the date and time of the GlideDateTime object.">setValue()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-setValueUTC_S_S"> <h2 class="title topictitle2" id="ariaid-title78">GlideDateTime - setValueUTC(String dateTime, String format)</h2> <div class="body refbody"><p class="shortdesc">Sets a date and time value using the UTC time zone and the specified date and time format.</p> <div class="section"> <p class="p">This method throws a runtime exception if the date and time format used in the dateTime parameter does not match the format parameter. You can retrieve the error message by calling <span class="keyword apiname">getErrorMsg()</span> on the GlideDateTime object after the exception is caught.</p> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-setValueUTC_S_S__table_p5w_35c_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 150. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e12032">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e12035">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e12038">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e12032 ">dateTime</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e12035 ">String</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e12038 ">The date and time to use.</td></tr><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e12032 ">format</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e12035 ">String</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e12038 ">The format to use.</td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-setValueUTC_S_S__table_q5w_35c_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 151. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e12087">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e12090">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e12087 ">void</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e12090 "> </td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime("2011-01-01 12:00:00"); gdt.setValueUTC("15-02-2011 08:00:00", "dd-MM-yyyy HH:mm:ss"); gs.print(gdt.getValue());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>2011-02-15 08:00:00</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-setValueUTC_S_S__section_ft1_qxr_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">setValueUTC()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeSetValueUTC_String_dt_String_format" title="Sets a date and time value using the UTC time zone and the specified date and time format. This method throws a runtime exception if the date and time format used in the dt parameter does not match the format parameter. You can retrieve the error message by calling getErrorMsg() on the GlideDateTime object after the exception is caught.">setValueUTC()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-setYear_N"> <h2 class="title topictitle2" id="ariaid-title79">GlideDateTime - setYear(Number year)</h2> <div class="body refbody"><p class="shortdesc">Sets the year stored by the GlideDateTime object to a specified value using the Java Virtual Machine time zone.</p> <div class="section"> <p class="p">Use <span class="keyword apiname">setYearLocalTime()</span> or <span class="keyword apiname">setYearUTC()</span> instead of this method.</p> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-setYear_N__table_tgf_4xl_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 152. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e12218">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e12221">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e12224">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e12218 ">year</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e12221 ">Number</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e12224 ">The year to change to.</td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-setYear_N__table_ugf_4xl_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 153. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e12261">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e12264">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e12261 ">void</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e12264 "> </td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime(); gdt.setYear(2013); gs.print(gdt.getYear());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>2013</code></pre> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-setYearLocalTime_N"> <h2 class="title topictitle2" id="ariaid-title80">GlideDateTime - setYearLocalTime(Number year)</h2> <div class="body refbody"><p class="shortdesc">Sets the year stored by the GlideDateTime object to a specified value using the current user's time zone.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-setYearLocalTime_N__table_vp4_1yl_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 154. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e12356">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e12359">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e12362">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e12356 ">year</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e12359 ">Number</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e12362 ">The year to change to.</td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-setYearLocalTime_N__table_wp4_1yl_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 155. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e12399">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e12402">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e12399 ">void</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e12402 "> </td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime(); gdt.setYearLocalTime(2013); gs.print(gdt.getYearLocalTime());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>2013</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-setYearLocalTime_N__section_mjw_5xr_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">setYearLocalTime()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeSetYearLocalTime_Number" title="Sets the year stored by the GlideDateTime object to the specified value using the current user's time zone.">setYearLocalTime()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-setYearUTC_N"> <h2 class="title topictitle2" id="ariaid-title81">GlideDateTime - setYearUTC(Number year)</h2> <div class="body refbody"><p class="shortdesc">Sets the year stored by the GlideDateTime object to a specified value using the UTC time zone.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-setYearUTC_N__table_fzh_jyl_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 156. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e12512">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e12515">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e12518">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e12512 ">year</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e12515 ">Number</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e12518 ">The year to change to.</td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-setYearUTC_N__table_gzh_jyl_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 157. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e12555">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e12558">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e12555 ">void</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e12558 "> </td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime(); gdt.setYearUTC(2013); gs.print(gdt.getYearUTC());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>2013</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-setYearUTC_N__section_q3v_wxr_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">setYearUTC()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeSetYearUTC_Number" title="Sets the year stored by the GlideDateTime object to the specified value using the UTC time zone.">setYearUTC()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-subtract_GT"> <h2 class="title topictitle2" id="ariaid-title82">GlideDateTime - subtract(GlideTime time)</h2> <div class="body refbody"><p class="shortdesc">Subtracts a specified amount of time.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-subtract_GT__table_lsb_nzk_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 158. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e12669">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e12672">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e12675">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e12669 ">time</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e12672 ">GlideTime</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e12675 ">The time to subtract</td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-subtract_GT__table_msb_nzk_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 159. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e12712">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e12715">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e12712 ">void</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e12715 "> </td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime("2011-08-31 08:00:00"); var gtime1 = new GlideTime(); gtime1.setValue("00:00:20"); gdt.subtract(gtime1); gs.print(gdt.getTime());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>1970-01-01 07:59:40</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-subtract_GT__section_ltp_byr_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">subtract()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeSubtract_GlideTime" title="Subtracts a specified amount of time from the current GlideDateTime object.">subtract()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-subtract_N"> <h2 class="title topictitle2" id="ariaid-title83">GlideDateTime - subtract(Number milliseconds)</h2> <div class="body refbody"><p class="shortdesc">Subtracts a specified number of milliseconds from the GlideDateTime object.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-subtract_N__table_r54_mtl_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 160. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e12825">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e12828">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e12831">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e12825 ">milliseconds</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e12828 ">Number</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e12831 ">The number of milliseconds to subtract</td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-subtract_N__table_s54_mtl_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 161. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e12868">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e12871">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e12868 ">void</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e12871 "> </td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime("2011-12-07 08:00:00"); gdt.subtract(1000); gs.print(gdt.getValue());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>2011-12-07 07:59:59</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-subtract_N__section_ihx_qyr_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">subtract()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeSubtract_Number" title="Subtracts the specified number of milliseconds from the GlideDateTime object.">subtract()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-subtract_GDT_GDT"> <h2 class="title topictitle2" id="ariaid-title84">GlideDateTime - subtract(GlideDateTime start, GlideDateTime end)</h2> <div class="body refbody"><p class="shortdesc">Returns the duration difference between two specified GlideDateTime objects.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-subtract_GDT_GDT__table_gn2_grl_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 162. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e12982">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e12985">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e12988">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e12982 ">start</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e12985 ">GlideDateTime</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e12988 ">Start date object.</td></tr><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e12982 ">end</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e12985 ">GlideDateTime</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e12988 ">End date object.</td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-subtract_GDT_GDT__table_hn2_grl_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 163. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e13037">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e13040">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e13037 ">GlideDuration</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e13040 ">Duration difference between the two specified dates.</td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt1 = new GlideDateTime("2011-08-28 09:00:00"); var gdt2 = new GlideDateTime("2011-08-31 08:00:00"); var dur = GlideDateTime.subtract(gdt1, gdt2); // Difference between gdt1 and gdt2 gs.info(dur.getDisplayValue());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>2 Days 23 Hours</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-subtract_GDT_GDT__section_apm_zxr_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">subtract()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeSubtract_GlideDateTime_GlideDate_Time" title="Returns the duration difference between two specified GlideDateTime objects.">subtract()</a>.</p> </div> </div> </div> <div class="topic reference nested1 api-method" id="r_GDT-toString"> <h2 class="title topictitle2" id="ariaid-title85">GlideDateTime - toString()</h2> <div class="body refbody"><p class="shortdesc">Returns the date and time value stored by the GlideDateTime object in the internal format, yyyy-MM-dd HH:mm:ss, and the system time zone, UTC by default.</p> <div class="section"> <p class="p">This method is equivalent to <span class="keyword apiname">getValue()</span>.</p> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-toString__table_lyw_ls2_nt" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 164. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e13157">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e13160">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e13163">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e13157 ">None</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e13160 "> </td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e13163 "> </td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="r_GDT-toString__table_myw_ls2_nt" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 165. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e13198">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d768737e13201">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e13198 ">Object</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d768737e13201 ">The date and time stored by the GlideDateTime object in the system time zone and format.</td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>var gdt = new GlideDateTime("2011-08-31 08:00:00"); gs.print(gdt.toString());</code></pre> <p class="p">Output:</p> <pre class="pre codeblock"><code>2011-08-31 08:00:00</code></pre> </div> <div class="section scoped-equivalent" id="r_GDT-toString__section_fxf_tyr_mcb"><h3 class="title sectiontitle">Scoped equivalent</h3> <p class="p">To use the <span class="keyword apiname">toString()</span> method in a scoped application, use the corresponding scoped method: <a class="xref" href="../../glideDateTimeScoped/concept/c_GlideDateTimeScoped.html#r_ScopedGlideDateTimeToString" title="Gets the date and time value stored by the GlideDateTime object in the internal format, yyyy-MM-dd HH:mm:ss, and the system time zone, UTC by default. This method is equivalent to getValue().">toString()</a>.</p> </div> </div> </div> </div> </body></html></div>