cancel
Showing results for 
Search instead for 
Did you mean: 

how to get Yestuday date?

Former Member
0 Kudos

hI,

How to get yesturday date? in Message mapping. wht function should I use?

regards,

Ansar.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello ,

Use this code....

import java.text.*;

import java.util.*;

public class DateTest {

public static void main(String[] args) {

Calendar c = Calendar.getInstance();

DateFormat fmt = DateFormat.getDateInstance();

for(int i=0; i<30; ++i) {

c.add(Calendar.DAY_OF_MONTH, -1); //back one

System.out.println(fmt.format(c.getTime()));

}

}

}

With Regards,

Sagar

Answers (2)

Answers (2)

Former Member
0 Kudos

Just use this UDF without any input parameter

//write your code here

Calendar today = Calendar.getInstance();

today.add(Calendar.DATE, -1);

java.sql.Date yesterday = new java.sql.Date(today.getTimeInMillis());

return yesterday.toString();

Former Member
0 Kudos

Hi

Can it come in YYYYMMDD format? If not how to get?

regards

Ansar.

prateek
Active Contributor
0 Kudos

Use DateTrans standard function.

Regards,

Prateek

Former Member
0 Kudos

The output of my UDF should be transferred using DateTrans.

regards

Sameer

Former Member
0 Kudos

Hi

Use the currentDate function from Dates in UDF, then you can write a small UDF to get the previous date based on the value.

regards

Sameer