• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

datefiled in dd-mm-yyyy format  RSS feed

 
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

how to create a table with field DOB in dd-mm-yyyy format?

so that I can insert date in dd-mm-yyyy format .

thanks
indu
 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I always use date or timestamp for a date - time table column.
To define your table would be something like this:

To put in a row would be :


you use a mask in your to_date function of your sql to determine the date format you want.
 
indu iyengar
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

inserting finely .. but when I retrieve

the result is in yyyy-mm-yy format .
thanks
indu
 
Ranch Hand
Posts: 1179
Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A DATE field in a DB only 'holds' the date, in no specific format - you need to use DateFormat (SimpleDateFormat) to format your date to what you want afterwards.
 
Agador Paloi
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
or you can use a mask in your select



Agad
 
Ranch Hand
Posts: 338
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oracle stores all DATE data types as a seven digit binary. The format mask you use on insert statement has nothing to do with how it is stored.

As Agador correctly states, you use to_char to convert your date to a string and choose your format mask for display.

If you don't explicitly do this yourself, Oracle will internally call a version of to_char to convert the binary data to a string using the default date format parameter stored in the nls_database_parameter table. Usually this is dd-mon-rr by default.

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!