From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,45c857e19c4ee2df X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-06-27 14:33:41 PST Path: archiver1.google.com!newsfeed.google.com!sn-xit-03!supernews.com!nntp.cs.ubc.ca!newsfeed.direct.ca!look.ca!newsfeed1.earthlink.net!newsfeed2.earthlink.net!newsfeed.earthlink.net!news.mindspring.net!not-for-mail From: Larry Hazel Newsgroups: comp.lang.ada Subject: Re: Ada95 calendar package question Date: Wed, 27 Jun 2001 16:25:13 -0500 Organization: MindSpring Enterprises Message-ID: <3B3A4F39.63954C8E@mindspring.com> References: NNTP-Posting-Host: c7.ae.9c.c5 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Server-Date: 27 Jun 2001 21:24:51 GMT X-Mailer: Mozilla 4.76 [en] (Win98; U) X-Accept-Language: en,x-ns11F8K63r3NhQ,x-ns2r2e09OnmPe2 Xref: archiver1.google.com comp.lang.ada:9167 Date: 2001-06-27T21:24:51+00:00 List-Id: "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