How can we set end date as one month from today's date

Shantharao
Kilo Sage

How can we set end date as one month from today's date?

7 REPLIES 7

Harish KM
Kilo Patron
Kilo Patron

here you can find Setting a future date (business days only)


Regards
Harish

Robbie
Kilo Patron
Kilo Patron

Hi,


A helpful link on the wiki re dates and using the GlideDateTime object below.



The method you require is:


addMonthsUTC(int)



Example

var gdt = new GlideDateTime("2011-08-31 08:00:00"); 
gdt.addMonthsUTC(2);
gs.print(gdt.getDate());

Output:


*** Script: 2011-10-31


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. This method is available starting with the Eureka release.



http://wiki.servicenow.com/index.php?title=GlideDateTime#gsc.tab=0


Hi Robbie,



I need to set end date on service catalogs, for this i need to write catalog client scripts, could you assist me for this configuration on items



Thanks,


Burra


nayanawadhiya1
Kilo Sage

Hey Burra,



Use GLIDEDATETIME function for adding days refer this -


GlideDateTime - ServiceNow Wiki