cancel
Showing results for 
Search instead for 
Did you mean: 

I have Problem in Upload Date formate

Former Member
0 Kudos

Hi Friends,

I have one doubt on WDJ.

I have done one Application that application having one functionality that is Download data in to Excel. After download data into excel we can change the DATE cell and again upload Excel Data.

Here what I am getting problem is download data into SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy"); this date forame. And again upload data into Same date formate

But it is not uploaded

When I download data into SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); this date format that time it will upload successfully.

This is for Dowload data into Excel

if(StockEle.getConf_Shp_Date()==null)

{

ExcelEle.setConf_Shp_Date("null");

}

else

{

SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy");

Date ConfShpDate = wdContext.nodePoDetails_OutTab().getPoDetails_OutTabElementAt(i).getConf_Shp_Date();

String ConfShpDate1 = sdf.format(ConfShpDate); // will give dd-MM-yyyy

ExcelEle.setConf_Shp_Date(ConfShpDate1);

}

Here ExcelEle.setConf_Shp_Date data type is String

This is for Upload data

try

{

SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy");

//Date dt = sdf.parse(ele.getConf_Shp_Date());

// java.util.Date Date dt = sdf.parse(ele.getConf_Shp_Date());

java.util.Date dt = sdf.parse(ele.getConf_Shp_Date());

java.sql.Date sqlDate = new java.sql.Date(dt.getTime());

eleout.setEindt(sqlDate);

}

catch(Exception e)

{

e.printStackTrace();

}

eleout.setEindt data type is Date.

How to Solve this issue I want upload this type of date (dd.MM.yyyy).

Regards

Vijay Kalluri

Accepted Solutions (1)

Accepted Solutions (1)

former_member185086
Active Contributor
0 Kudos

Hi

Try to format it before sending it back , try using these code

// Create Date object.  Date date = new Date();  
//Specify the desired date format 
 String DATE_FORMAT = "MM/dd/yyyy"; 
 //Create object of SimpleDateFormat and pass the desired date format. 
 SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);  
 /*  Use format method of SimpleDateFormat class to format the date.  */ 

 System.out.println("Today is " + sdf.format(date) );

Best Regards

Satish Kumar

Answers (0)