CRS 3.5 Add 14 days to todays date

Unanswered Question
Aug 12th, 2008

I have a CRS 3.5 installation, We have a need to add 14 days to a date. I am having trouble getting CRS to do this.

Any help would be very helpful.

I have this problem too.
0 votes
  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 3 (1 ratings)
BCOLE2007 Tue, 08/12/2008 - 09:50

Hi dagraham

couple options I have ideas for.

Option A: Using CRS completely

1) Use the .month method to extract the Month from the date in a Set statement

2) Use the .dom method to extract the day of the month form the date in another set statement

2.5) Use the .year method to extract the year from the date in another set statement.

3) Add 14 days to the step 2 Day variable

4) Now the fun, You need to logical step statement, such as a switch or nested if, then looks up the month from step 1 and checks to see if the days from step 3 is over the number of days for the month, if it is subtract the number of days from the month, to get the day for the next month and add 1 to the next month

5) Remember the date exceptions, such as the Febuary leap year check, and if 14 days are added in the last 2 weeks of december then you would also need to set the Month to 1 for Jan(don't add it) and bump the year by one.

6) Build a new date variable using the calculated Day, Month and Year

This can be coded entirely in 1 set statement using Java or in a custom class.

Option B:

1) Use a database, select the date +14 from a dummy table

for example in oracle:

ensure $yourDate is in the format of the to_date string


to_char(to_date($yourDate,'MM/DD/YYYY')+14) as Date2weeks from dual

SQL server and DB2 should be able to do a similar kind of select as well


Use a Work Record in your Get Step with a field

called Date2weeks defined in it.

this works in CRS 4.1 with Oracle 10g


*Please rate useful posts

BCOLE2007 Tue, 08/12/2008 - 12:27

Sweet, another idea, haven't worked with it though.

I don't see anything in the 4.1 docs for the calender class but see the type in the editor.


dagraham Thu, 08/14/2008 - 06:30

Thanks for the replies. I would have loved to use ths calendar class and the add method but do not know java well enough.

We solved it this way.

1. Created an execute java method to get the current date in milliseconds. Used java.lang.System variable type and currentTimeMillis() method.

2. Used a set to add the result from the last step + the number of milliseconds for 14 days.

3. Created a new java object date type using the constructor date(long) so we have it saved as a date and not in milliseconds(long variable type).

We tested this for year end and leap year and it works great.

BCOLE2007 Thu, 08/14/2008 - 06:35

Sounds like a 4th way

Glad you found a way to do it.

Good Job!


>I would have loved to use ths calendar class and the add method but do not know java well enough

FYI - sample code ....

import java.util.Date;

import java.util.Calendar;

import java.util.GregorianCalendar;

public class TCal


public TCal()




private void doIt()


Calendar today = new GregorianCalendar();

today.add(Calendar.DATE, 14);

Date theDate = today.getTime();



public static void main(String[] args)


TCal tr = new TCal();





This Discussion