Christian Lisangola Christian Lisangola - 8 months ago 48
Java Question

Creating only month and year column in mysql database

I'm creating a little program with Java.In the date field which is a combobox for selecting only month and date as

.Is there a way to record this date format in mysql in a mm/yy field only?


Instead of storing it in this format, maybe the best approach is to store it as a normal date with the day always set to the first day of the month. And then at retrieval time you format the date, with something like a SimpleDateFormat, to only get the month and year and return it to your UI.