Thanks for the input Mark.
This approach seems OK to me.
What is the column you use to store dob ?
We need to specify in the repository_user.xml the data type
for this column.
Ed.
----- Original Message -----
From: "Mark Lowe" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Saturday, June 26, 2004 8:05 PM
Subject: Re: [OT] Storing Birth Date
> I do string - calendar conversion in an action form, its gets and sets
> strings modifying a calendar object which can be then given to the
> action ready to be saved back to the model.
>
> private Calendar dob = Calendar.getInstance();
>
> public String getDayOfBirth() {
> int dayInt = dob.get(Calendar.DAY_OF_MONTH);
> return Integer.parseInt(dayInt);
> }
>
> public void setDayOfBirth(String month) {
> int monthInt = Integer.parseInt(month);
> this.dob.set(Calendar.DAY_OF_MONTH,monthInt);
> }
>
> public Calendar getDob() {
> return dob;
> }
>
> public void setCalendar(Calendar dob) {
> this.dob = dob;
> }
>
> I should warn you that you need to validate input in a validate method
> to in case the day is out of range for the given calendar month. Unless
> you generate your select menus when the user changes the month and
> year.
>
> Some folk will frown upon such practice and claim its not MVC, I could
> be wrong but I disagree. And also gets the action form doing a little
> more work.
>
>
>
> Mark
>
> On 26 Jun 2004, at 13:24, Eddie Yan wrote:
>
> > Anyone know what is the best practices to store a person
> > date of birth ? How should we design our detail object, JSP and
> > database
> > in such way we don't have a messy approached to populate the day,
> > month and year in Action class to be able to display in JSP during
> > UPDATE
> > process.
> >
> > Currently, I have a JSP with combo box for day, month and year.
> > Using mySQL db, I set the dateOfBirth column to TIMESTAMP.
> > (Some told me to use DATE for this column).
> >
> > Obviously TIMESTAMP have the limitation since date of birth before
> > Jan 1 1970 will be stored as 00000000000. Know any workaround
> > to this one ?
> >
> >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]