• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

ClipBoard Date format

 
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic