This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Specify Date as 0000-00-00  RSS feed

 
Angela lewis
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to specify the date as 0000-00-00.
if i use
java.sql.Date end_on = new java.sql.Date(00000000L);
it gives me the value
1970-01-01
I am using Oracle as database.
 
john smith
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use the TO_DATE oracle function. java.sql.Date is seeded from Jan 1, 1970 00:00:00.000 GMT, so you'll not get a date earlier than this.
 
Adrian Yan
Ranch Hand
Posts: 688
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ummm... I don't think there is such date as 0000-00-00, calendar starts with January first (01-01). If you want to use it as a placeholder why not use null?
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Note, though, that there was no year 0; years in A.D. start counting at 1. It'd be perfectly valid for any software to reject your attempts to represent this date.
 
Angela lewis
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank You so much for helping.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!