• Post Reply Bookmark Topic Watch Topic
  • New Topic

can timestamp be given null values  RSS feed

 
neha priya
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello everyone,

my query is that can timestamp take null value??

suppose i have a date combobox that is initially set to null value.
if someone doesn't provide any value in the datecombobox and leaves it null then will this statement run?[size=12]








please suggest me some method how can i provide null value or empty value to datecombobox and be able to compile it successfully.

thanks.

[/size]
 
Martin Vanyavchich
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm not sure if I understand all the implications but I think this should work.



For code readibility you could expand that in a full if statement
 
neha priya
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for replying....i tried what you suggested i.e.


but during runtime am getting:java.lang.NullPointerException

please suggest how do i resolve this..
 
Rob Spoor
Sheriff
Posts: 21133
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think it's startDateCombo that will be null but startDateCombo.getDate. So:
Note that I have chosen to make the entire Timestamp null rather than give it a time of 0.
 
buntha Choudhary
Ranch Hand
Posts: 136
Android Eclipse IDE Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
we can provide the default value for the comboBox with current date , if in case no value is being provided.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!