on 05-12-2010 8:50 PM
Hi Guys,
I have one doubt on WDJ,
While exporting data into Excel Sheet having date format is showing like the format (YYYY-MM-DD).
But I need to convert into this format (DD-MM-YYYY). Can any one suggest me? How to convert (YYYY-MM-DD) to (DD-MM-YYYY)
I was written this code for getting date from ECC System and Convert to String type.
Date DelivDate = wdContext.nodePoDetails_ExcelData().getPoDetails_ExcelDataElementAt(i).getDeliv_Date();
String DelivDate1 = DelivDate.toString();
Date ShtDate = wdContext.nodePoDetails_ExcelData().getPoDetails_ExcelDataElementAt(i).getStat_Date();
String ShtDate1 = ShtDate.toString();
//wdComponentAPI.getMessageManager().reportSuccess("ShtDate1::"+ShtDate1);
Date ExptShpDate = wdContext.nodePoDetails_ExcelData().getPoDetails_ExcelDataElementAt(i).getExpt_Shp_Date();
String ExptShpDate1 = ExptShpDate.toString();
Regards
Vijay Kalluri
Hi Vijay,
Since you already have a Date object I would use the SimpleDateFormat class to format the String the way you want. Something like this:
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
sdf.format(date);
Note the M for month is upper case, m is for minute.
-Greg
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Greg,
Still i haven't resolve the issue.
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
sdf.format(date);
Date DelivDate = wdContext.nodePoDetails_ExcelData().getPoDetails_ExcelDataElementAt(i).getDeliv_Date();
String DelivDate1 = DelivDate.toString();
could you please give me more clarification on above code. if possible.
Regards
Vijay Kalluri
Hi Vijay,
sdf.format(date) doesn't actually change your object, just returns a String representation of that object in the format you want.
Date DelivDate = wdContext.nodePoDetails_ExcelData().getPoDetails_ExcelDataElementAt(i).getDeliv_Date();
String DelivDate1 = DelivDate.toString(); //will give yyyy-MM-dd
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
String DelivDate2 = sdf.format(DelivDate); // will give dd-MM-yyyy
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.