This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes comparing timestamp object to null Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "comparing timestamp object to null" Watch "comparing timestamp object to null" New topic
Author

comparing timestamp object to null

harpd dhillon
Greenhorn

Joined: Jun 03, 2003
Posts: 8
Hello,
i'm developing a servlet that shows the fields of table in mysql , and if the field is null, it shows blank. I don't know how to compare timestamp object to null. For example:
java.sql.Timestamp endtime = rs.getTimestamp("endtime");
Now, i wanna check if the database value is null and if it is i wanna leave it blank.
thanks for your help
David Hibbs
Ranch Hand

Joined: Dec 19, 2002
Posts: 374
it the DB entry is null, rs.getXXX will return null. So a simple reference check will suffice. i.e.

[ June 03, 2003: Message edited by: David Hibbs ]

"Write beautiful code; then profile that beautiful code and make little bits of it uglier but faster." --The JavaPerformanceTuning.com team, Newsletter 039.
harpd dhillon
Greenhorn

Joined: Jun 03, 2003
Posts: 8
thanks a lot for your David.
It workedddddddddddddddd!!!
harpd dhillon
Greenhorn

Joined: Jun 03, 2003
Posts: 8
i meant thanks a lot for you help.
have a good one
 
 
subject: comparing timestamp object to null
 
Similar Threads
showing blank if the value in database is null
Storing date as null value in the backend using JDBC
Updating timestamp field
Appending the data in frame or popup window
Hibernate generates "bad" SQL in Bulk update