How to add 1minute to current time using to date time field?

Ash41
Kilo Sage

Hi Team, 

 

I want to add 1minute to the current date time field, please help with script

I tried below not working

var gtime1 = new GlideTime();
gtime1.addSeconds(60);

1 ACCEPTED SOLUTION

Mohith Devatte
Tera Sage
Tera Sage

hello Ash,

try this please 

var gtime1 = new GlideDateTime();
gtime1.addSeconds(60);


Mark the answer correct if this helps you

View solution in original post

3 REPLIES 3

Mohith Devatte
Tera Sage
Tera Sage

hello Ash,

try this please 

var gtime1 = new GlideDateTime();
gtime1.addSeconds(60);


Mark the answer correct if this helps you

Mahendra RC
Mega Sage

Hello,
You can use the above script provided by other community member or if you set the value for some Date/Type field then you the below and check once.

var gtime1 = new GlideDateTime();
gtime1.addSeconds(60);
//if you want to set this value so some date/time field then
//current.<field_name>.setDateNumericValue(gtime1.getNumericValue());
//gr.<field_name>.setDateNumericValue(gtime1.getNumericValue()); (where gr is GlideRecord object)

Please mark my respsone as helpful/correct, if it answer your question.

Thanks

Ash41
Kilo Sage

It worked, thank you so much