on 04-08-2011 3:32 PM
Hi everyone
I am fairly new to Java and PI, and I have to create a UDF that takes the currentDate and subtracts 7 days. I was just wondering the best way to go about this with java?
Thank You
UDF Code as below ..
Calendar now = Calendar.getInstance();
now.add(Calendar.DATE, -7);
String subtractSevenDays = new SimpleDateFormat("yyyy/MM/dd").format(now.getTime());
return subtractSevenDays;
// Dont forget below import statements
import java.text.SimpleDateFormat;
import java.util.Calendar;
Map it to target field.
Note: You can choose any pattern in the above SimpleDateFormat argument.
Currently the output will be ex: 2011/04/01
Edited by: Baskar Gopal on Apr 8, 2011 10:56 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok Sorry I missed some of that last post, It works
Thank you everyone
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I still seem to be getting errors?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Have a look into this blog and see case 5..
/people/sarvesh.singh3/blog/2009/02/13/yes-it-is-possible-with-datetrans-function
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI,
you can use the grafical Function "current date" and "DateBefore" or "DateAfter".
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.