• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: custom formatter
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: custom formatter


  • Subject: Re: custom formatter
  • From: LD <email@hidden>
  • Date: Tue, 19 Jul 2005 14:27:52 +1000

Hi there,

On 18/07/2005, at 9:20 PM, Dev WO wrote:


I'm not sure the subject is correct, but here's my problem:
I've got warranty validity information stored as weeks in the database. I'd like to display them in either week(s), month or year (s), but not like "3.5 month", I'd like the number to always be an integer (not rounded), so a 6 weeks warranty will be displayed "6 weeks" and a 4 weeks warranty will be dispayed "1 month".


Does anyone has a suggestion for this?


Storing weeks is going to send you 'round the twist. Months would be much better. i.e., You'll need to bear in mind that 52 / 4 == 13 rather than 12. This means that when you are storing your numberOfWeeks that you'll need to translate correctly.


i.e., 1 month == 52 / 12 which == 4.333333
      2 months == 52 / 6 which == 8.6666666
      3 months == 52 / 4 but 3 months != 4 * 3.
      6 months == 52 / 2 but 6 months != 4 * 6.
      12 months == 52 weeks.
      18 months == 52 * 1.5 weeks
      and so on...

That's a mess. Your best bet is to change your strategy before you go any further...

with regards,
--

LD



_______________________________________________
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


References: 
 >custom formatter (From: Dev WO <email@hidden>)

  • Prev by Date: How do you add java -D Option to Build?
  • Next by Date: Automatic indexing solution
  • Previous by thread: Re: custom formatter
  • Next by thread: howto combine DirectActions with ComponentActions?
  • Index(es):
    • Date
    • Thread