Christian Lisangola Christian Lisangola - 1 year ago 72
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?

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download