• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

date order change,,,

 
Ranch Hand
Posts: 336
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I declared a column in table as:

The date set in table is of type yyyy-mm-dd .Is this default? I want to change it to dd-mm-yyyy as my values to be set in the table are of the form dd-mm-yyyy

My DB is MySql... how do i change it?
 
Bartender
Posts: 2661
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi. The database does not store your date in that format. Your query tool shows it like that, but internally, the date is stored as a numeric value.
You can use the MySQL date formatting functions to show the date as you please.

In a java program, you could format the date using java.text.SimpleDateFormat. To convert your dd-mm-yyyy from String to Date, you can use SimpleDateFormat.parse(). You can then insert that Date in your database. Here is an example of both cases.

Regards, Jan
 
reply
    Bookmark Topic Watch Topic
  • New Topic