Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

ClipBoard Date format  RSS feed

 
Mini Pilla
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I have Oct 29,2002 as date in one of the cells in Jtable.
I wrote a code to copy that date.(Jpopup right click menu)
When i try to paste the date it changes its format to 2002-10-28.
ANy ideas..to preserve the date format.
I showing my code here!!
for (int i=0;i<numrows;i++)
{
for (int j=0;j<numcols;j++)
{

sbf.append(table.getValueAt(rowsselected[i],colsselected[j]));
///in getvalue() method i don't know what is the format because it coming from another program

table.setValueAt("",rowsselected[i],colsselected[j]);

if (j<numcols-1) sbf.append("\t");
}
sbf.append("\n");
}
[ October 29, 2002: Message edited by: Rajani Katta ]
[ October 29, 2002: Message edited by: Rajani Katta ]
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To preserve the date format, you'll have to save the data in the table as a String instead of a Date... but then you'll have to convert it back to a Date before you can use it again as a Date.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!