• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Date format

 
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I created a java.sql.Date object in following way and insurted it in my_table

Date d = new Date(System.System.currentTimeMillis());


When I use SQL+ to check, I found that no hour, minute, and second info:

SQL> select TO_CHAR(my_dt, 'mm-dd-yyyy hh24:mi:ss') as My_dt from my_table;

MY_DT
-------------------
08-24-2004 00:00:00
08-24-2004 00:00:00
08-24-2004 00:00:00
08-24-2004 00:00:00
08-24-2004 00:00:00

Could anyone tell me why? I'm using Oracle. Thanks!
 
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
java.sql.Date is just a date (unlike java.util.Date). If you want to store a timestamp, use java.sql.Timestamp.
 
What are your superhero powers? Go ahead and try them on this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic