This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin for Android App Development and have Peter Sommerhoff on-line!
See this thread for details.
Win a copy of Kotlin for Android App Development this week in the Kotlin forum!
  • 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
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

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.

 
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!