on 08-19-2011 12:58 PM
How to convert Date from string format to java.util.Calendar format in WDJ for saving in MDM tables?
Hi Isha,
You can use following code to convert string date to calender format.
String stringDate="23-Aug-10";
SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy");
Date date = formatter.parse(stringDate);
Calendar calender = Calendar.getInstance();
calender.setTime(date);
After conveting into calender you can use DateTimeValue class to save in MDM table.
DateTimeValue mdmDate = new DateTimeValue(calendar);
I hope it helps.
Regards,
Rohit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Please check this code.
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
try {
Date today = df.parse("19/08/2011");
System.out.println("Today = " + df.format(today));
}
catch (ParseException e)
{
e.printStackTrace();
}
Please reffer [this|; and [conver String to Date|]thread.
Hope this helps!!
Thanks & Regards
Vijay
Edited by: VijaySAPEP on Aug 19, 2011 6:59 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
9 | |
8 | |
6 | |
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.