comp.lang.ada
 help / color / mirror / Atom feed
* Ada95 calendar package question
@ 2001-06-27  0:54 Vladimir Bednikov
  2001-06-27  3:44 ` James Rogers
                   ` (3 more replies)
  0 siblings, 4 replies; 34+ messages in thread
From: Vladimir Bednikov @ 2001-06-27  0:54 UTC (permalink / raw)


Hi all,

I'm using gnat3.13p on an sgi with gcc2.8.1 and am wondering if there is a
way of
getting the day of week and month in text format. I.E.
Mon, Tue, Wed, Thu, Fri, Sat and Sun for days of the week and
Jan, Feb, Mar, Apr .... for the month of the year.

Thanks in advance.





^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Ada95 calendar package question
  2001-06-27  0:54 Ada95 calendar package question Vladimir Bednikov
@ 2001-06-27  3:44 ` James Rogers
  2001-06-27  8:32   ` Peter Hermann
  2001-06-27 14:56   ` Larry Kilgallen
  2001-06-27 13:14 ` Marin David Condic
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 34+ messages in thread
From: James Rogers @ 2001-06-27  3:44 UTC (permalink / raw)


Vladimir Bednikov wrote:
> 
> Hi all,
> 
> I'm using gnat3.13p on an sgi with gcc2.8.1 and am wondering if there is a
> way of
> getting the day of week and month in text format. I.E.
> Mon, Tue, Wed, Thu, Fri, Sat and Sun for days of the week and
> Jan, Feb, Mar, Apr .... for the month of the year.

Ada does not provide such conversions as part of the Ada.Calendar
package. Which representation for days of the week and month names
is appropriate in all situations and cultures?

Ada does allow you to calculate the results yourself.

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));

In this case Time_Value is a variable of type Ada.Calendar.Time.

Converting to the names of the days of the week is a bit more work.
The following generic package works for all the dates I have tested.
Note that it expects an enumerated type for the generic parameter.
The function Day_Of_Week will work only when the first day of the
week is a representation of Sunday

-----------------------------------------------------------------------
-- Day of the Week Package for any date after January 1, 1901
--
-- This generic package works when Sunday is declared to be the
-- first day of the week. It must be the first value of the 
-- enumerated type used in the actual generic parameter.
-----------------------------------------------------------------------
with Ada.Calendar;

generic
type weekdays is (<>);
package Day_Conversion is
   function Day_Of_Week (Date : Ada.Calendar.Time) return weekdays;
end Day_Conversion;

-----------------------------------------------------------------------
-- Day of the Week Package for any date after January 1, 1901
-----------------------------------------------------------------------

package body Day_Conversion is
function Day_Of_Week (Date : Ada.Calendar.Time) return weekdays is
	year_diff : Natural;
	The_Month : Ada.Calendar.Month_Number;
	The_Year  : Ada.Calendar.Year_Number;
	The_Day   : Ada.Calendar.Day_Number;
	The_Day_Number : Natural := 0;
	Month_Days : array(Ada.Calendar.Month_Number) of Natural := 
	    (0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 );
begin
	The_Month := Ada.Calendar.Month(Date);
	The_Year := Ada.Calendar.Year(Date);
	The_Day  := Ada.Calendar.Day(Date);
	Year_Diff := The_Year - 1901;
	The_Day_Number := (Year_Diff * 365) + (( Year_Diff / 4 )
	                - (Year_Diff / 100) + (Year_Diff / 400) 
			+ Natural(Month_Days(The_Month)) 
			+ Natural(The_Day) - 1);
	if (The_Year mod 4) = 0 and (The_Month > 2) then
	   The_Day_Number := The_Day_Number + 1;
	end if;
	return Weekdays'Val((The_Day_Number + 2) mod 7);
end Day_Of_Week;
end Day_Conversion;

Jim Rogers
Colorado Springs, Colorado USA



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Ada95 calendar package question
  2001-06-27  3:44 ` James Rogers
@ 2001-06-27  8:32   ` Peter Hermann
  2001-06-27 13:01     ` James Rogers
  2001-06-27 13:24     ` Marin David Condic
  2001-06-27 14:56   ` Larry Kilgallen
  1 sibling, 2 replies; 34+ messages in thread
From: Peter Hermann @ 2001-06-27  8:32 UTC (permalink / raw)


James Rogers <jimmaureenrogers@worldnet.att.net> wrote:
> Vladimir Bednikov wrote:
>> Mon, Tue, Wed, Thu, Fri, Sat and Sun for days of the week and
>> Jan, Feb, Mar, Apr .... for the month of the year.
> -- This generic package works when Sunday is declared to be the
> -- first day of the week. It must be the first value of the 

Sorry James, but:
I very much prefer Monday as the first day of the week,
simply because it is the first day of the week  :-)

see:
http://www.csv.ica.uni-stuttgart.de/homes/ph/adapilotresources/basic_tools/calenday.ads

-- 
Peter Hermann Tel+49-711-685-3611 Fax3758 ica2ph@csv.ica.uni-stuttgart.de
Pfaffenwaldring 27 Raum 114, D-70569 Stuttgart Uni Computeranwendungen
http://www.csv.ica.uni-stuttgart.de/homes/ph/
Team Ada: "C'mon people let the world begin" (Paul McCartney)



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Ada95 calendar package question
  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
  1 sibling, 1 reply; 34+ messages in thread
From: James Rogers @ 2001-06-27 13:01 UTC (permalink / raw)



Peter Hermann wrote:
> 
> James Rogers <jimmaureenrogers@worldnet.att.net> wrote:
> > Vladimir Bednikov wrote:
> >> Mon, Tue, Wed, Thu, Fri, Sat and Sun for days of the week and
> >> Jan, Feb, Mar, Apr .... for the month of the year.
> > -- This generic package works when Sunday is declared to be the
> > -- first day of the week. It must be the first value of the
> 
> Sorry James, but:
> I very much prefer Monday as the first day of the week,
> simply because it is the first day of the week  :-)

Ah, more cultural differences. American calendars usually start the
week with Sunday. There are two solutions to the problem.
Simply alter the algorithm to add one to the number generated before
calculating the enumeration value. Follow that up by using the
updated version listed below. Upon further testing I found the
calculation had a Year 2000 defect in it.

I translated the original formulas from an ancient C text. Those
formulas (formulae ?) were only good through 1999.

-----------------------------------------------------------------------
-- Day of the Week Package for any date after January 1, 1901
--
-- This generic package works when Sunday is declared to be the
-- first day of the week. It must be the first value of the 
-- enumerated type used in the actual generic parameter.
-----------------------------------------------------------------------
with Ada.Calendar;

generic
type weekdays is (<>);
package Day_Conversion is
   function Day_Of_Week (Date : Ada.Calendar.Time) return weekdays;
end Day_Conversion;

-----------------------------------------------------------------------
-- Day of the Week Package for any date after January 1, 1901
-----------------------------------------------------------------------

package body Day_Conversion is
function Day_Of_Week (Date : Ada.Calendar.Time) return weekdays is
	year_diff : Natural;
	The_Month : Ada.Calendar.Month_Number;
	The_Year  : Ada.Calendar.Year_Number;
	The_Day   : Ada.Calendar.Day_Number;
	The_Day_Number : Natural := 0;
	Month_Days : array(Ada.Calendar.Month_Number) of Natural := 
	    (0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 );
begin
	The_Month := Ada.Calendar.Month(Date);
	The_Year := Ada.Calendar.Year(Date);
	The_Day  := Ada.Calendar.Day(Date);
	Year_Diff := The_Year - 1901;
	The_Day_Number := (Year_Diff * 365) + (( Year_Diff / 4 )
			+ Natural(Month_Days(The_Month)) 
			+ Natural(The_Day) - 1);

	if The_Year >= 2000 then
		The_Day_Number := The_Day_Number - ((The_Year - 2000)/ 100);
		The_Day_Number := The_Day_Number + ((The_Year - 2000) / 400);  
	end if;  
	if (The_Year mod 4 = 0) and (The_Month > 2) then
	   The_Day_Number := The_Day_Number + 1;
	end if;
	return Weekdays'Val((The_Day_Number + 2) mod 7);
end Day_Of_Week;
end Day_Conversion;

I apologize for the original error.

Jim Rogers
Colorado Springs, Colorado USA



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Ada95 calendar package question
  2001-06-27  0:54 Ada95 calendar package question Vladimir Bednikov
  2001-06-27  3:44 ` James Rogers
@ 2001-06-27 13:14 ` Marin David Condic
  2001-06-27 14:24 ` Samuel T. Harris
  2001-06-28  1:57 ` Jeffrey Carter
  3 siblings, 0 replies; 34+ messages in thread
From: Marin David Condic @ 2001-06-27 13:14 UTC (permalink / raw)


There are a bunch of date/time tools on my website in a collection of code
labeled "Utilities" - see http://www.mcondic.com/Ada_Programming.html to
find it. Look for a package called UTIL.Date_Tools - there may be something
in there that is useful to you...

MDC
--
Marin David Condic
Senior Software Engineer
Pace Micro Technology Americas    www.pacemicro.com
Enabling the digital revolution
e-Mail:    marin.condic@pacemicro.com
Web:      http://www.mcondic.com/


"Vladimir Bednikov" <Vladimir.Bednikov@ebor.com> wrote in message
news:9hbb9n$g14$1@fang.dsto.defence.gov.au...
> Hi all,
>
> I'm using gnat3.13p on an sgi with gcc2.8.1 and am wondering if there is a
> way of
> getting the day of week and month in text format. I.E.
> Mon, Tue, Wed, Thu, Fri, Sat and Sun for days of the week and
> Jan, Feb, Mar, Apr .... for the month of the year.
>
> Thanks in advance.
>
>





^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Ada95 calendar package question
  2001-06-27  8:32   ` Peter Hermann
  2001-06-27 13:01     ` James Rogers
@ 2001-06-27 13:24     ` Marin David Condic
  2001-06-27 13:59       ` Wes Groleau
                         ` (3 more replies)
  1 sibling, 4 replies; 34+ messages in thread
From: Marin David Condic @ 2001-06-27 13:24 UTC (permalink / raw)


Sorry, Peter. It isn't. Historically, Sunday is the first day of the week.
Practically, people treat Monday as the first day of the week because that's
the day we all go back to work. However, I think if you dig into the
historic roots of it you'll discover that a) The Jewish tradition had the
Sabbath as Saturday and therefore Sunday was the first day of the week. b)
The early Christians - also being Jewish - went to Synagog on the Sabbath,
then gathered on the first day of the week for Christian celebration. c) the
Roman calendars that form the basis for our modern day calendar were
established by Christians - keeping Sunday as the first day of the week.

To a large extent, its pretty much an arbitrary and capricious choice as to
which day is "first" - but I think you'll find most calendars adhere to the
Sunday/First convention.

MDC
--
Marin David Condic
Senior Software Engineer
Pace Micro Technology Americas    www.pacemicro.com
Enabling the digital revolution
e-Mail:    marin.condic@pacemicro.com
Web:      http://www.mcondic.com/


"Peter Hermann" <ica2ph@iris16.csv.ica.uni-stuttgart.de> wrote in message
news:9hc5n4$jl$1@infosun2.rus.uni-stuttgart.de...
> James Rogers <jimmaureenrogers@worldnet.att.net> wrote:
> > Vladimir Bednikov wrote:
> >> Mon, Tue, Wed, Thu, Fri, Sat and Sun for days of the week and
> >> Jan, Feb, Mar, Apr .... for the month of the year.
> > -- This generic package works when Sunday is declared to be the
> > -- first day of the week. It must be the first value of the
>
> Sorry James, but:
> I very much prefer Monday as the first day of the week,
> simply because it is the first day of the week  :-)
>
> see:
>
http://www.csv.ica.uni-stuttgart.de/homes/ph/adapilotresources/basic_tools/c
alenday.ads
>
> --
> Peter Hermann Tel+49-711-685-3611 Fax3758 ica2ph@csv.ica.uni-stuttgart.de
> Pfaffenwaldring 27 Raum 114, D-70569 Stuttgart Uni Computeranwendungen
> http://www.csv.ica.uni-stuttgart.de/homes/ph/
> Team Ada: "C'mon people let the world begin" (Paul McCartney)





^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Ada95 calendar package question
  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 14:38         ` Noé Lavallée
  2001-06-27 14:32       ` Ian Wild
                         ` (2 subsequent siblings)
  3 siblings, 2 replies; 34+ messages in thread
From: Wes Groleau @ 2001-06-27 13:59 UTC (permalink / raw)



> To a large extent, its pretty much an arbitrary and capricious choice as to
> which day is "first" - but I think you'll find most calendars adhere to the
> Sunday/First convention.

There is now winding down a long (both in duration and number of posts)
argument on this issue in alt.usage.english or alt.english.usage
Apparently, many if not most calendars in Europe start with Monday.

-- 
Wes Groleau
http://freepages.rootsweb.com/~wgroleau



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Ada95 calendar package question
  2001-06-27 13:01     ` James Rogers
@ 2001-06-27 14:01       ` Wes Groleau
  0 siblings, 0 replies; 34+ messages in thread
From: Wes Groleau @ 2001-06-27 14:01 UTC (permalink / raw)



> > I very much prefer Monday as the first day of the week,
> > simply because it is the first day of the week  :-)
> 
> Ah, more cultural differences. American calendars usually start the
> week with Sunday. There are two solutions to the problem.

Make  Sunday => 0   then for start of week, we can use 'First
and Europeans can use 1

:-)

-- 
Wes Groleau
http://freepages.rootsweb.com/~wgroleau



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Ada95 calendar package question
  2001-06-27  0:54 Ada95 calendar package question Vladimir Bednikov
  2001-06-27  3:44 ` James Rogers
  2001-06-27 13:14 ` Marin David Condic
@ 2001-06-27 14:24 ` Samuel T. Harris
  2001-06-28  1:57 ` Jeffrey Carter
  3 siblings, 0 replies; 34+ messages in thread
From: Samuel T. Harris @ 2001-06-27 14:24 UTC (permalink / raw)


Vladimir Bednikov wrote:
> 
> Hi all,
> 
> I'm using gnat3.13p on an sgi with gcc2.8.1 and am wondering if there is a
> way of
> getting the day of week and month in text format. I.E.
> Mon, Tue, Wed, Thu, Fri, Sat and Sun for days of the week and
> Jan, Feb, Mar, Apr .... for the month of the year.
> 
> Thanks in advance.

The original Booch Ada 83 component has extensive
calendar extensions. You can find them at www.adapower.com.

-- 
Samuel T. Harris, Senior Software Engineer II
Raytheon, Aerospace Engineering Services
"If you can make it, We can fake it!"



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Ada95 calendar package question
  2001-06-27 13:24     ` Marin David Condic
  2001-06-27 13:59       ` Wes Groleau
@ 2001-06-27 14:32       ` Ian Wild
  2001-06-27 22:37       ` Ehud Lamm
  2001-06-28 11:27       ` Alfred Hilscher
  3 siblings, 0 replies; 34+ messages in thread
From: Ian Wild @ 2001-06-27 14:32 UTC (permalink / raw)


Marin David Condic wrote:
> 
> To a large extent, its pretty much an arbitrary and capricious choice as to
> which day is "first" ...

...however, ISO (ISO8601:1988) chooses Monday, and if it's good enough
for ISO, it's good enough for me.



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Ada95 calendar package question
  2001-06-27 13:59       ` Wes Groleau
@ 2001-06-27 14:36         ` Marin David Condic
  2001-06-27 15:17           ` Ted Dennison
                             ` (2 more replies)
  2001-06-27 14:38         ` Noé Lavallée
  1 sibling, 3 replies; 34+ messages in thread
From: Marin David Condic @ 2001-06-27 14:36 UTC (permalink / raw)


Well, its been discussed here before. Like I said, there is a certain amount
of arbitrariness to it - make Wednesday be the first day if you like - but I
don't think it is inaccurate to point out that *historically*, Sunday is the
first day of the week and any other convention is ignoring a lot of history.
One can ignore history at one's own risk. :-)

Odd that it was Roman calendars (European) that pretty much set Sunday as
the first day of the week and now the Europeans don't use this convention
while the US still does. When was it Europe decided to pitch their own
standard?

MDC
--
Marin David Condic
Senior Software Engineer
Pace Micro Technology Americas    www.pacemicro.com
Enabling the digital revolution
e-Mail:    marin.condic@pacemicro.com
Web:      http://www.mcondic.com/


"Wes Groleau" <wwgrol@ftw.rsc.raytheon.com> wrote in message
news:3B39E6C2.680A5CA@ftw.rsc.raytheon.com...
>
> > To a large extent, its pretty much an arbitrary and capricious choice as
to
> > which day is "first" - but I think you'll find most calendars adhere to
the
> > Sunday/First convention.
>
> There is now winding down a long (both in duration and number of posts)
> argument on this issue in alt.usage.english or alt.english.usage
> Apparently, many if not most calendars in Europe start with Monday.
>
> --
> Wes Groleau
> http://freepages.rootsweb.com/~wgroleau





^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Ada95 calendar package question
  2001-06-27 13:59       ` Wes Groleau
  2001-06-27 14:36         ` Marin David Condic
@ 2001-06-27 14:38         ` Noé Lavallée
  1 sibling, 0 replies; 34+ messages in thread
From: Noé Lavallée @ 2001-06-27 14:38 UTC (permalink / raw)




Wes Groleau a �crit :

> > To a large extent, its pretty much an arbitrary and capricious choice as to
> > which day is "first" - but I think you'll find most calendars adhere to the
> > Sunday/First convention.
>
> There is now winding down a long (both in duration and number of posts)
> argument on this issue in alt.usage.english or alt.english.usage
> Apparently, many if not most calendars in Europe start with Monday.

Yes, back here in France ALL calendars start the week on Monday. (by the way,
United Nations calendars do too).





^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Ada95 calendar package question
  2001-06-27  3:44 ` James Rogers
  2001-06-27  8:32   ` Peter Hermann
@ 2001-06-27 14:56   ` Larry Kilgallen
  1 sibling, 0 replies; 34+ messages in thread
From: Larry Kilgallen @ 2001-06-27 14:56 UTC (permalink / raw)


In article <3B395724.6B4B9B67@worldnet.att.net>, James Rogers <jimmaureenrogers@worldnet.att.net> writes:
> Vladimir Bednikov wrote:
>> 
>> Hi all,
>> 
>> I'm using gnat3.13p on an sgi with gcc2.8.1 and am wondering if there is a
>> way of
>> getting the day of week and month in text format. I.E.
>> Mon, Tue, Wed, Thu, Fri, Sat and Sun for days of the week and
>> Jan, Feb, Mar, Apr .... for the month of the year.
> 
> Ada does not provide such conversions as part of the Ada.Calendar
> package. Which representation for days of the week and month names
> is appropriate in all situations and cultures?

Certainly one culture that must be considered is the culture of the
operating system on which one is running.  Many operating systems
have their own standard for how programs should display dates,
along with the ability for a user to express personal preferences.
If you are running on such an operating system, you should strongly
consider using the operating system method, even if it means making
a call to non-Ada code.



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Ada95 calendar package question
  2001-06-27 14:36         ` Marin David Condic
@ 2001-06-27 15:17           ` Ted Dennison
  2001-06-27 15:43           ` Frank
  2001-06-27 15:59           ` Philip Anderson
  2 siblings, 0 replies; 34+ messages in thread
From: Ted Dennison @ 2001-06-27 15:17 UTC (permalink / raw)


In article <9hcr23$o0d$1@nh.pace.co.uk>, Marin David Condic says...
>Odd that it was Roman calendars (European) that pretty much set Sunday as
>the first day of the week and now the Europeans don't use this convention
>while the US still does. When was it Europe decided to pitch their own
>standard?

Probably about the time Seventh-day Adventists starting knocking on their doors
like they do here. :-)

---
T.E.D.    homepage   - http://www.telepath.com/dennison/Ted/TED.html
          home email - mailto:dennison@telepath.com



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Ada95 calendar package question
  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
  2 siblings, 1 reply; 34+ messages in thread
From: Frank @ 2001-06-27 15:43 UTC (permalink / raw)


Hi!

>
> Odd that it was Roman calendars (European) that pretty much set Sunday as
> the first day of the week and now the Europeans don't use this convention
> while the US still does. When was it Europe decided to pitch their own
> standard?

It probably because God took the seventh day off, and looked upon everything
...

Another unalignment I have seen between Europe and US/America is the way the
weeks are counted/numbered.
:-)

Frank





^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Ada95 calendar package question
  2001-06-27 14:36         ` Marin David Condic
  2001-06-27 15:17           ` Ted Dennison
  2001-06-27 15:43           ` Frank
@ 2001-06-27 15:59           ` Philip Anderson
  2001-06-27 16:20             ` Ted Dennison
                               ` (2 more replies)
  2 siblings, 3 replies; 34+ messages in thread
From: Philip Anderson @ 2001-06-27 15:59 UTC (permalink / raw)


Marin David Condic wrote:
> 
> Well, its been discussed here before. Like I said, there is a certain amount
> of arbitrariness to it - make Wednesday be the first day if you like - but I
> don't think it is inaccurate to point out that *historically*, Sunday is the
> first day of the week and any other convention is ignoring a lot of history.
> One can ignore history at one's own risk. :-)

No, the history was fine.  But to jump from there to saying "most
calendars ..." was dangerous; saying "most" in an international,
multicultural, multidisciplinary forum like this often is :-)


> Odd that it was Roman calendars (European) that pretty much set Sunday as
> the first day of the week and now the Europeans don't use this convention
> while the US still does. When was it Europe decided to pitch their own
> standard?

I don't know.  After the French Revolution perhaps?  But the ISO
standard can no doubt be dated.

My (British English) dictionary defines Sunday as the first day of the
week and I still think of it that way if asked (and so do the Seventh
Day Adventists obviously); but calendars, diaries and week-numbering
here all start with a Monday.  Timetables too use 1-7 stgarting from
Monday.  Maybe we should use 0-6, so Sunday is the first day, but Monday
is Day 1?

Personally I find it much more convenient to be able to write a weekend
event across two consecutive boxes than at the end of one row and the
beginning of the next.  But are Americans allowed to include Sunday in a
"weekend"? :-)


-- 
hwyl/cheers,
Philip Anderson
Alenia Marconi Systems
Cwmbr�n, Cymru/Wales



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Ada95 calendar package question
  2001-06-27 15:43           ` Frank
@ 2001-06-27 16:07             ` Aron Felix Gurski
  0 siblings, 0 replies; 34+ messages in thread
From: Aron Felix Gurski @ 2001-06-27 16:07 UTC (permalink / raw)


Frank wrote:
<snip>
> Another unalignment I have seen between Europe and US/America is the way the
> weeks are counted/numbered.

There's an ISO standard on how weeks are to be numbered. This is what is used in
Europe. The standard *specifies* that for the purpose of numbering weeks, Monday
is the first day of the week.

-- 
        -- Aron

NB: To reply by e-mail, remove "spam-block." from my address.
- - - - - - - - - - -
"To be successful, a woman has to be better at her job than a man."

        -- Golda Meir



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Ada95 calendar package question
  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
  2 siblings, 0 replies; 34+ messages in thread
From: Ted Dennison @ 2001-06-27 16:20 UTC (permalink / raw)


In article <3B3A02ED.456FED12@amsjv.com>, Philip Anderson says...
>
>Personally I find it much more convenient to be able to write a weekend
>event across two consecutive boxes than at the end of one row and the
>beginning of the next.  But are Americans allowed to include Sunday in a
>"weekend"? :-)

Sure. Sunday's "end" just happens to be the front end. :-)

---
T.E.D.    homepage   - http://www.telepath.com/dennison/Ted/TED.html
          home email - mailto:dennison@telepath.com



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Ada95 calendar package question
       [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
  0 siblings, 1 reply; 34+ messages in thread
From: David C. Hoos @ 2001-06-27 16:44 UTC (permalink / raw)
  To: comp.lang.ada


----- Original Message -----
From: "M. A. Alves" <maa@liacc.up.pt>
To: <comp.lang.ada@ada.eu.org>
Sent: Wednesday, June 27, 2001 12:39 PM
Subject: Re: Ada95 calendar package question


<snip>
> (saturday => s�bado, clearly from "sabbath", sunday => domingo, no
> etimology known to me)
domingo => "The Lord's Day" from the Latin "Domini."





^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Ada95 calendar package question
  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
  2 siblings, 0 replies; 34+ messages in thread
From: M. A. Alves @ 2001-06-27 17:39 UTC (permalink / raw)
  To: comp.lang.ada

The portuguese calendar has the best from both "worlds".  It keeps
historical numbering right in the names:

  monday => segunda = _second_
  ...
  friday => sexta = sixth

but starts the week on monday.

(saturday => s�bado, clearly from "sabbath", sunday => domingo, no
etimology known to me)

-- 
   ,
 M A R I O   data miner, LIACC, room 221   tel 351+226078830, ext 121
 A M A D O   Rua Campo Alegre, 823         fax 351+226003654
 A L V E S   P-4150 PORTO, Portugal        mob 351+939354002




^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Ada95 calendar package question
  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
  2 siblings, 0 replies; 34+ messages in thread
From: Wes Groleau @ 2001-06-27 18:23 UTC (permalink / raw)



> Personally I find it much more convenient to be able to write a weekend
> event across two consecutive boxes than at the end of one row and the
> beginning of the next.  But are Americans allowed to include Sunday in a
> "weekend"? :-)

That works if you're used to it.  But when I tried to use such a calendar,
I was constantly getting "one-off" errors in recording or reading entries.

-- 
Wes Groleau
http://freepages.rootsweb.com/~wgroleau



^ permalink raw reply	[flat|nested] 34+ messages in thread

* RE: Ada95 calendar package question
@ 2001-06-27 20:39 Beard, Frank
  2001-06-27 21:25 ` Larry Hazel
  0 siblings, 1 reply; 34+ messages in thread
From: Beard, Frank @ 2001-06-27 20:39 UTC (permalink / raw)
  To: 'comp.lang.ada@ada.eu.org'


-----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



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Ada95 calendar package question
  2001-06-27 20:39 Beard, Frank
@ 2001-06-27 21:25 ` Larry Hazel
  0 siblings, 0 replies; 34+ messages in thread
From: Larry Hazel @ 2001-06-27 21:25 UTC (permalink / raw)


"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



^ permalink raw reply	[flat|nested] 34+ messages in thread

* RE: Ada95 calendar package question
@ 2001-06-27 21:55 Beard, Frank
  0 siblings, 0 replies; 34+ messages in thread
From: Beard, Frank @ 2001-06-27 21:55 UTC (permalink / raw)
  To: 'comp.lang.ada@ada.eu.org'



-----Original Message-----
From: Larry Hazel [mailto:lhazel@mindspring.com]

> type Months is (Ignore, Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct,
Nov,
> Dec);

Yes, but then you have put a comment above it explaining what "Ignore" is
supposed
to mean.  I think a better self-documenting place holder would be:

  type Months is
(PlaceHolderSoThatValuesReturnedByAdaCalendarMonthWillLineUpWithThisType,
                  Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov,
Dec);

Frank

PS.

I case someone can't figure it out, that was really a joke.  But the more I
think about
it, it would probably be alright because no one is going to use the actual
value.  For
initialization, you would be setting the variable to 'FIRST anyway.



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Ada95 calendar package question
  2001-06-27 13:24     ` Marin David Condic
  2001-06-27 13:59       ` Wes Groleau
  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 11:27       ` Alfred Hilscher
  3 siblings, 1 reply; 34+ messages in thread
From: Ehud Lamm @ 2001-06-27 22:37 UTC (permalink / raw)



Marin David Condic <marin.condic.auntie.spam@pacemicro.com> wrote in message
news:9hcmq5$m93$1@nh.pace.co.uk...
> Sorry, Peter. It isn't. Historically, Sunday is the first day of the week.
> Practically, people treat Monday as the first day of the week because
that's
> the day we all go back to work.

Well, y'all may start your work week on Mondays, but here in Israel we start
working on Sunday...

Obviously Saturady is not a working day here for religious reasons (yep, we
are Jewish). Funny thing is that when we moved to a five day work week, we
made Friday part of the weekend, and not Sunday...


--
Ehud Lamm   mslamm@mscc.huji.ac.il
http://purl.oclc.org/NET/ehudlamm <==  Me!








^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Ada95 calendar package question
  2001-06-27  0:54 Ada95 calendar package question Vladimir Bednikov
                   ` (2 preceding siblings ...)
  2001-06-27 14:24 ` Samuel T. Harris
@ 2001-06-28  1:57 ` Jeffrey Carter
  3 siblings, 0 replies; 34+ messages in thread
From: Jeffrey Carter @ 2001-06-28  1:57 UTC (permalink / raw)


Vladimir Bednikov wrote:
> 
> I'm using gnat3.13p on an sgi with gcc2.8.1 and am wondering if there is a
> way of
> getting the day of week and month in text format. I.E.
> Mon, Tue, Wed, Thu, Fri, Sat and Sun for days of the week and
> Jan, Feb, Mar, Apr .... for the month of the year.

PragmARC.Date_Handler, part of the PragmAda Reusable Components
available from

http://home.earthlink.net/~jrcarter010/pragmarc.htm

or from the mirror on www.adapower.net, can do this and much more.

-- 
Jeff Carter
"Nobody expects the Spanish Inquisition!"
Monty Python's Flying Circus



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Ada95 calendar package question
  2001-06-27 16:44 ` David C. Hoos
@ 2001-06-28  8:29   ` Philip Anderson
  0 siblings, 0 replies; 34+ messages in thread
From: Philip Anderson @ 2001-06-28  8:29 UTC (permalink / raw)


"David C. Hoos" wrote:
> 
> domingo => "The Lord's Day" from the Latin "Domini."

Specifically from the adjectival "dominicus", like the Italian
"Domenica" & French "dimanche"


-- 
hwyl/cheers,
Philip Anderson
Alenia Marconi Systems
Cwmbr�n, Cymru/Wales



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Ada95 calendar package question
  2001-06-27 13:24     ` Marin David Condic
                         ` (2 preceding siblings ...)
  2001-06-27 22:37       ` Ehud Lamm
@ 2001-06-28 11:27       ` Alfred Hilscher
  2001-06-28 14:17         ` Ted Dennison
  3 siblings, 1 reply; 34+ messages in thread
From: Alfred Hilscher @ 2001-06-28 11:27 UTC (permalink / raw)


Oh. What is weekend then ? For me it is Saturday and Sunday. Is this
different for you ? It must be if the week starts with Sunday (although
I like every sunny day ;-) ).

Marin David Condic wrote:
> 
> Sorry, Peter. It isn't. Historically, Sunday is the first day of the week.
>
> "Peter Hermann" <ica2ph@iris16.csv.ica.uni-stuttgart.de> wrote in message
>
> > I very much prefer Monday as the first day of the week,
> > simply because it is the first day of the week  :-)
> >
> > see:
> >
> http://www.csv.ica.uni-stuttgart.de/homes/ph/adapilotresources/basic_tools/c
> alenday.ads
> >
> > --
> > Peter Hermann Tel+49-711-685-3611 Fax3758 ica2ph@csv.ica.uni-stuttgart.de
> > Pfaffenwaldring 27 Raum 114, D-70569 Stuttgart Uni Computeranwendungen
> > http://www.csv.ica.uni-stuttgart.de/homes/ph/
> > Team Ada: "C'mon people let the world begin" (Paul McCartney)



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Ada95 calendar package question
  2001-06-27 22:37       ` Ehud Lamm
@ 2001-06-28 13:17         ` Marin David Condic
  2001-06-28 14:33           ` Wes Groleau
  0 siblings, 1 reply; 34+ messages in thread
From: Marin David Condic @ 2001-06-28 13:17 UTC (permalink / raw)


Well, this would make sense given - as I observed - that the Sunday=First
Day thingie came out of the Jewish observation of the Sabbath. It would be
logical for Israel to have Friday/Saturday as the weekend. There may, of
course, be practical considerations for those doing international
business...

MDC
--
Marin David Condic
Senior Software Engineer
Pace Micro Technology Americas    www.pacemicro.com
Enabling the digital revolution
e-Mail:    marin.condic@pacemicro.com
Web:      http://www.mcondic.com/


"Ehud Lamm" <mslamm@mscc.huji.ac.il> wrote in message
news:9hdnkv$se7$1@news.huji.ac.il...
>
> Marin David Condic <marin.condic.auntie.spam@pacemicro.com> wrote in
message
> news:9hcmq5$m93$1@nh.pace.co.uk...
> > Sorry, Peter. It isn't. Historically, Sunday is the first day of the
week.
> > Practically, people treat Monday as the first day of the week because
> that's
> > the day we all go back to work.
>
> Well, y'all may start your work week on Mondays, but here in Israel we
start
> working on Sunday...
>
> Obviously Saturady is not a working day here for religious reasons (yep,
we
> are Jewish). Funny thing is that when we moved to a five day work week, we
> made Friday part of the weekend, and not Sunday...
>
>
> --
> Ehud Lamm   mslamm@mscc.huji.ac.il
> http://purl.oclc.org/NET/ehudlamm <==  Me!
>
>
>
>
>





^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Ada95 calendar package question
  2001-06-28 11:27       ` Alfred Hilscher
@ 2001-06-28 14:17         ` Ted Dennison
  2001-06-28 14:49           ` Marin David Condic
  0 siblings, 1 reply; 34+ messages in thread
From: Ted Dennison @ 2001-06-28 14:17 UTC (permalink / raw)


In article <3B3B14AF.94B712C1@icn.siemens.de>, Alfred Hilscher says...
>
>Oh. What is weekend then ? For me it is Saturday and Sunday. Is this
>different for you ? It must be if the week starts with Sunday (although

Nope. The weekend is Saturday (back end) and Sunday (front end). :-)

---
T.E.D.    homepage   - http://www.telepath.com/dennison/Ted/TED.html
          home email - mailto:dennison@telepath.com



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Ada95 calendar package question
  2001-06-28 13:17         ` Marin David Condic
@ 2001-06-28 14:33           ` Wes Groleau
  2001-06-28 20:38             ` Ehud Lamm
  0 siblings, 1 reply; 34+ messages in thread
From: Wes Groleau @ 2001-06-28 14:33 UTC (permalink / raw)



> Well, this would make sense given - as I observed - that the Sunday=First
> Day thingie came out of the Jewish observation of the Sabbath. It would be
> logical for Israel to have Friday/Saturday as the weekend. There may, of
> course, be practical considerations for those doing international
> business...
>
> > Obviously Saturady is not a working day here for religious reasons (yep,
> we
> > are Jewish). Funny thing is that when we moved to a five day work week, we
> > made Friday part of the weekend, and not Sunday...

Since the Sabbath begins at sundown on the Gentile Friday, to work a full day
on Friday could make things rather rushed before sundown--which would kind of
go against the spirit of the Sabbath.

-- 
Wes Groleau
http://freepages.rootsweb.com/~wgroleau



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Ada95 calendar package question
  2001-06-28 14:17         ` Ted Dennison
@ 2001-06-28 14:49           ` Marin David Condic
  2001-06-28 16:28             ` M. A. Alves
  0 siblings, 1 reply; 34+ messages in thread
From: Marin David Condic @ 2001-06-28 14:49 UTC (permalink / raw)


As in getting both the head and tail of a list? You have both 'ends' of the
week? Its a double-ended list! And now, we're back to actual computer
related topics! :-)

MDC
--
Marin David Condic
Senior Software Engineer
Pace Micro Technology Americas    www.pacemicro.com
Enabling the digital revolution
e-Mail:    marin.condic@pacemicro.com
Web:      http://www.mcondic.com/


"Ted Dennison" <dennison@telepath.com> wrote in message
news:30H_6.405$Kf3.3029@www.newsranger.com...
>
> Nope. The weekend is Saturday (back end) and Sunday (front end). :-)
>






^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Ada95 calendar package question
  2001-06-28 14:49           ` Marin David Condic
@ 2001-06-28 16:28             ` M. A. Alves
  0 siblings, 0 replies; 34+ messages in thread
From: M. A. Alves @ 2001-06-28 16:28 UTC (permalink / raw)
  To: comp.lang.ada

> As in getting both the head and tail of a list? You have both 'ends' of the
> week? Its a double-ended list! And now, we're back to actual computer
> related topics! :-)

And note that curiously enough the actual computing issues viz.

  1. calculating the day of the week
  2. names and positions in printed calendars

are independent.

-- 
   ,
 M A R I O   data miner, LIACC, room 221   tel 351+226078830, ext 121
 A M A D O   Rua Campo Alegre, 823         fax 351+226003654
 A L V E S   P-4150 PORTO, Portugal        mob 351+939354002




^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Ada95 calendar package question
  2001-06-28 14:33           ` Wes Groleau
@ 2001-06-28 20:38             ` Ehud Lamm
  0 siblings, 0 replies; 34+ messages in thread
From: Ehud Lamm @ 2001-06-28 20:38 UTC (permalink / raw)



Wes Groleau <wwgrol@ftw.rsc.raytheon.com> wrote in message
news:3B3B4023.F2DB16A7@ftw.rsc.raytheon.com...
> Since the Sabbath begins at sundown on the Gentile Friday, to work a full
day
> on Friday could make things rather rushed before sundown--which would kind
of
> go against the spirit of the Sabbath.
>


Friday was a short day when we had six-day work week. It still is, for those
places open on Firday.
It is not just because of the spirit of the Sabbath: During the winter the
days are too short for people to get home before the Sabbath starts, and
since observant Jews don't drive during the Sabbath, they would be stuck at
work...


--
Ehud Lamm   mslamm@mscc.huji.ac.il
http://purl.oclc.org/NET/ehudlamm <==  Me!








^ permalink raw reply	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2001-06-28 20:38 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-27  0:54 Ada95 calendar package question 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
     [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
  -- strict thread matches above, loose matches on Subject: below --
2001-06-27 20:39 Beard, Frank
2001-06-27 21:25 ` Larry Hazel
2001-06-27 21:55 Beard, Frank

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox