From: Larry Hazel <lhazel@mindspring.com>
Subject: Re: Ada95 calendar package question
Date: Wed, 27 Jun 2001 16:25:13 -0500
Date: 2001-06-27T21:24:51+00:00 [thread overview]
Message-ID: <3B3A4F39.63954C8E@mindspring.com> (raw)
In-Reply-To: mailman.993674453.22403.comp.lang.ada@ada.eu.org
"Beard, Frank" wrote:
>
> -----Original Message-----
> From: James Rogers [mailto:jimmaureenrogers@worldnet.att.net]
>
> > Converting month numbers to month names is simple. Create an enumerated
> > type containing the month names you want, then convert the
> > Ada.Calendar.Month_Number to the corresponding month name:
> >
> > type months is (Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep,
> > Oct, Nov, Dec);
> > Month_Name : Months := Months'Val(Ada.Calendar.Month(Time_Value));
>
> Except that Ada.Calendar.Month returns a number in the range of 1 to 12,
> while 'POS and 'VAL for type months works on values in the range of 0 to 11.
>
> So, you would have to do something like the following:
>
> Month_Name : Months := Months'Val(Ada.Calendar.Month(Time_Value) - 1);
>
> But that would probably cause CONSTRAINT_ERROR in January, so you end up
> with:
>
> Month_Name : Months := Months'Val(natural(Ada.Calendar.Month(Time_Value))
> - 1);
>
> Frank
type Months is (Ignore, Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov,
Dec);
Larry
next prev parent reply other threads:[~2001-06-27 21:25 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-06-27 20:39 Ada95 calendar package question Beard, Frank
2001-06-27 21:25 ` Larry Hazel [this message]
-- strict thread matches above, loose matches on Subject: below --
2001-06-27 21:55 Beard, Frank
[not found] <Pine.LNX.4.21.0106271731050.8027-100000@borba.ncc.up.pt>
2001-06-27 16:44 ` David C. Hoos
2001-06-28 8:29 ` Philip Anderson
2001-06-27 0:54 Vladimir Bednikov
2001-06-27 3:44 ` James Rogers
2001-06-27 8:32 ` Peter Hermann
2001-06-27 13:01 ` James Rogers
2001-06-27 14:01 ` Wes Groleau
2001-06-27 13:24 ` Marin David Condic
2001-06-27 13:59 ` Wes Groleau
2001-06-27 14:36 ` Marin David Condic
2001-06-27 15:17 ` Ted Dennison
2001-06-27 15:43 ` Frank
2001-06-27 16:07 ` Aron Felix Gurski
2001-06-27 15:59 ` Philip Anderson
2001-06-27 16:20 ` Ted Dennison
2001-06-27 17:39 ` M. A. Alves
2001-06-27 18:23 ` Wes Groleau
2001-06-27 14:38 ` Noé Lavallée
2001-06-27 14:32 ` Ian Wild
2001-06-27 22:37 ` Ehud Lamm
2001-06-28 13:17 ` Marin David Condic
2001-06-28 14:33 ` Wes Groleau
2001-06-28 20:38 ` Ehud Lamm
2001-06-28 11:27 ` Alfred Hilscher
2001-06-28 14:17 ` Ted Dennison
2001-06-28 14:49 ` Marin David Condic
2001-06-28 16:28 ` M. A. Alves
2001-06-27 14:56 ` Larry Kilgallen
2001-06-27 13:14 ` Marin David Condic
2001-06-27 14:24 ` Samuel T. Harris
2001-06-28 1:57 ` Jeffrey Carter
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox