Re: Advice on datetime manipulation
Re: Advice on datetime manipulation
- Subject: Re: Advice on datetime manipulation
- From: Ken Anderson <email@hidden>
- Date: Mon, 24 Oct 2005 14:09:46 -0400
Why not just get the current year and subtract the year of birth?
On Oct 24, 2005, at 1:37 PM, Dev WO wrote:
Thanks Sacha,
you are right, "age" is calculated based on "the first new year
following the date of birth".
I'll dig into the datetime methods to see if there's already
something I could use...
On Oct 24, 2005, at 10:24 AM, Dev WO wrote:
Hi list,
usually I do something stupid and then ask for your help;) so
this time I though it would be wise to ask before doing something
"not good":)
So I have to handle poneys and horses (yes it's funny), and they
have something very specific:
These "items" aren't 1 year old when they have 12 month!
In fact they get 1 year old when they cross their first "new
year", so if it has born on december 29th it will be 1 year old
only 3 days after...
And I have to manage "categories" depending of their "age".
So my question is regarding the clever way to handle that.
I've got their date of birth in database. I don't think I can
handle something like their "official age" directly in the
EOModel (but I may be wrong), so I think I have to handle that
directly in code.
Quite some items are already in the database, but maybe it would
be good to handle this when they insert the item like having
another attribute "official date of birth" which will be set to
the previous new year and so doing the "regular" calculation on
this attribute and not on the "real" date of birth.
Or handling all this when generating the list only.
Any advice on this is greatly appreciated, or pointer to specific
method that would be of help:)
Sounds like the "age" is a calculated field, based on date of
birth. Your best bet is probably to create a method "age" on your
EO that returns the age, calculated from the date of birth.
HTH,
sacha
--
Sacha Michel Mallais Senior Developer / President
Global Village Consulting Inc. http://www.global-village.net/
PGP Key ID: 7D757B65 AIM: smallais
Bottom posting is your friend:
http://www.river.com/users/share/etiquette/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40anderhome.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden