• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Specify Date as 0000-00-00

 
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
Marshal
Pie
Posts: 24208
35
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic