File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes can timestamp be given null values Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "can timestamp be given null values" Watch "can timestamp be given null values" New topic
Author

can timestamp be given null values

neha priya
Ranch Hand

Joined: Jul 03, 2010
Posts: 62
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

Joined: Sep 16, 2008
Posts: 241
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


SCJP 6, OCMJD 6, OCPJWSD 6
I no good English.
neha priya
Ranch Hand

Joined: Jul 03, 2010
Posts: 62
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

Joined: Oct 27, 2005
Posts: 19230

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.


SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
buntha Choudhary
Ranch Hand

Joined: Jul 03, 2009
Posts: 136

we can provide the default value for the comboBox with current date , if in case no value is being provided.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: can timestamp be given null values
 
Similar Threads
problem with JTable - while inserting JComboBox (DateComboBox)
comparing 2 jar files with timsramp and size
timezone conversion using DST
Locale wise 301 redirect in jsp
how to get the date from the string representation of date