Highlighted
Super Contributor.. Super Contributor..
Super Contributor..
367 views

SM 9.4 - is it possible to create a rule to set a date to 30 days beyond today?

Jump to solution

is it possible to create a rule to set a date to 30 days beyond the current date/time?

I tried the following code that did not work:  

value=date(tod())+'30 00:00:00'"

0 Likes
1 Solution

Accepted Solutions
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: SM 9.4 - is it possible to create a rule to set a date to 30 days beyond today?

Jump to solution

Well, there are these two different date types:

System Language date/time

- to call System language function from JS, you'll need to use it like this: system.functions.tod(),

and

JavaScript Date.

 

In Javascript, there are following constructors for Date object:

var d = new Date();    // returns now
var d = new Date(milliseconds);
var d = new Date(dateString);
var d = new Date(year, month, day, hours, minutes, seconds, milliseconds);

So you can do this:

var f = new Date(new Date().getTime() + 1000 * 60 * 60 * 24 * 30);

 

View solution in original post

2 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: SM 9.4 - is it possible to create a rule to set a date to 30 days beyond today?

Jump to solution

Well, there are these two different date types:

System Language date/time

- to call System language function from JS, you'll need to use it like this: system.functions.tod(),

and

JavaScript Date.

 

In Javascript, there are following constructors for Date object:

var d = new Date();    // returns now
var d = new Date(milliseconds);
var d = new Date(dateString);
var d = new Date(year, month, day, hours, minutes, seconds, milliseconds);

So you can do this:

var f = new Date(new Date().getTime() + 1000 * 60 * 60 * 24 * 30);

 

View solution in original post

Highlighted
Super Contributor.. Super Contributor..
Super Contributor..

Re: SM 9.4 - is it possible to create a rule to set a date to 30 days beyond today?

Jump to solution

that worked - we used a set field using using javascript and used

value =  new Date(new Date().getTime() + 1000 * 60 * 60 * 24 * 30);

BOOOOOM!! Thanks!

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.