Dear All, I'm fetching a set of data from the database which includes some date values. This is my code:
When we run:
Now I want to format the date in dd/MM/yyyy format for which I use SimpleDateFormat class
My code now:
But now the output is:
It's not displaying other datas, once it encounters the first null value in date. But when we don't use formatting, these null values are also getting displayed. Now, my requirement is 1) I want to display the date value in a formatted manner 2) If atall some null date values are there it should be presented as null. I want the output to be in this format.
The challenge is won now , by including a simple if statement after fetching the date value & checking for null value. Note the whole output is formatted using String.format method which is highlighted. Code:
subject: A challenge while formatting date value from the database