On my DB i have a date column with this format: '2016-10-05'
How can i obtain the actual date on this format?
I tried with
Date date = new Date();
But the format is not compatible and it doesen't works.
On my DB i have a date column with this format: '2016-10-05'
How can i obtain the actual date on this format?
I tried with
Date date = new Date();
But the format is not compatible and it doesen't works.
Date date = new SimpleDateFormat("yyyy-MM-dd").parse(stringWithDate);
You have to use SimpleDataFormat
which allows you to parse String
s with different formats to Date