• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

can timestamp be given null values

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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]
 
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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..
 
Sheriff
Posts: 22849
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 136
Android Eclipse IDE Windows XP
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic