on 01-15-2013 8:52 AM
Hi,
I have a incoming date of format YYYY:MM:DD-HH:MM:SS
We need to increment the time by 10 minutes. Can anyone help me with the UDF.
TIA
Hi Kiran,
YYYY:MM:DD-HH:MM:SS is not standard date format . I assume that format is "yyyy-MM-dd HH:mm:ss".
Very simple to increment minutes by 10 from UDF .
In function, make argument as string .Use the code below and return the value .
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = new Date () ;
try
{
date = ( Date )formatter.parse(var1);
}
catch ( ParseException e){}
Calendar clndr = Calendar.getInstance();
clndr.setTime(date);
clndr.add(clndr.MINUTE, 10);
date = clndr.getTime();
String strDate = formatter.format(date);
return strDate;
This will complete your requirement .
thanks and regards,
Anup Banerjee
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
I am getting some errors at runtime
Function calculate, Line 1:
cannot find symbol symbol : class DateFormat location: class com.sap.xi.tf._MM_********** DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); ^
Function calculate, Line 1:
cannot find symbol symbol : class SimpleDateFormat location: class com.sap.xi.tf._MM_********** DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
^
Function calculate, Line 13:
cannot find symbol symbol : class ParseException location: class com.sap.xi.tf._MM_********** catch ( ParseException e){} ^ Note: /usr/sap/XPI/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map497c143f5f1311e29edb000000127d02/source/com/sap/xi/tf/_MM_**********.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. 3 errors
Hi,
Use the below logic.Fine tune it as per your req.
import java.util.Calendar;
Date Inputtime
Calendar calendar = Calendar.getInstance();
calendar.setTime(Inputtime);
calendar.add(Calendar.MINUTE, 10);
Inputtime = calendar.getTime();
Regrads
Venkat
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.