Reputation: 558
I need a java class with several attributes that must have day and month (june 5. july 8, etc). What is the best way to define this field?
The type day of year will have problems with leap years, and dividing the attribute into day and month will make me have a lot of them (since I need several of these) so is there another approach to this field?
Also: I use MySql for persistance, so I want attributeseasy to persist.
Upvotes: 0
Views: 198
Reputation: 21047
Two options:
dayNumber
and monthNumber
, and store them in your MySQL database as two tinyInt
fields. char
array (4 entries) in Java, and store the value in a Char(4)
field in MySQLI would personally go with option 1
Upvotes: 1