comp.lang.ada
 help / color / mirror / Atom feed
* Re: calander package - Proposal for dates
@ 2001-03-16  8:49 Christoph Grein
  2001-03-16 17:21 ` Robert A Duff
  2001-03-17  2:55 ` Jeffrey Carter
  0 siblings, 2 replies; 25+ messages in thread
From: Christoph Grein @ 2001-03-16  8:49 UTC (permalink / raw)
  To: comp.lang.ada

I've created a set of packages with specification. There's also
an implementation with test program.
It's not perfect (it's only for dates, not for times, and the Is_Leap_Year
function is maybe misplaced) but it might serve as a start.
I use two child packages, because otherwise the functions are not resolvable
when defaults are used.
(The mailer might ruin the indentation.)
------------------------------------------------------------------------
with Ada.Calendar;
with Ada.Strings.Unbounded;
use  Ada.Strings.Unbounded;

package Calendar_Format is

  --====================================================================
  -- Author    Christoph Grein
  -- Version   0.0
  -- Date      15 March 2001
  --====================================================================
  -- Various date formats are defined.
  --
  -- Numeric formats consists of all numbers for days, months, and
  -- years.
  -- Text formats use names for months. To allow for language specific
  -- names, they are defined with a (non-constant) array of (unbounded)
  -- strings.
  --
  -- Numeric Formats:
  -- ----------------
  --
  -- These formats are described by enumeration literals where D stands
  -- for a day digit, M for a month digit, and Y for a year digit.
  -- A single character D or M signifies that only as much digits will
  -- be used as needed, DD or MM signifies that always two digits will
  -- be used.
  -- YYYY signifies that all four digits of a year will be used, YY
  -- signifies the abbreviate form.
  --
  -- Examples:
  --
  --   10-12-1815 Lady Ada's birthday with
  --              DD_MM_YYYY and '-' separator
  --   12/10/80   First Ada Standard DOD-MIL-STD 1815 with
  --              MM_DD_YY and '/' separator
  --   1.1.2001   The begin of the new millenium with
  --              D_M_YYYY or M_D_YYYY and '.' separator
  --   01.01.01   The same date with with DD_MM_YY or MM_DD_YY
  --
  -- Text Formats:
  -- -------------
  --
  -- There are tow formats differing only in the placement of day and
  -- month. In day, month, year sequence, the values are separated by
  -- one blank character, in month, day, year sequence, an additional
  -- comma is inserted between day and year value. The day value uses
  -- one or two digits as appropriate.
  -- Additionally an ordinal separator may be inserted after the day
  -- value.
  --
  -- Examples:
  --
  -- 10 December 1815    Day_Month_Year with None separator
  -- 10. December 1980   Day_Month_Year with '.' separator
  -- December 10, 1980   Month_Day_Year with None separator
  -- December 10th, 1980 Month_Day_Year with English_Ordinal separator
  -- 1st January 2001    Day_Month_Year with English_Ordinal separator
  --====================================================================
  -- History
  -- Author Version   Date    Reason for change
  --  C.G.    0.0  15.03.2001 PDL
  --====================================================================

  use Ada;

  function Is_Leap_Year (Year: Calendar.Year_Number) return Boolean;

  -- Numeric Formats:

  type Numeric_Date_Format is (D_M_YY,
                               D_M_YYYY,
                               DD_MM_YY,
                               DD_MM_YYYY,
                               MM_DD_YY,
                               MM_DD_YYYY,
                               YYYY_MM_DD);

  Standard_Numeric_Date_Format: Numeric_Date_Format := D_M_YYYY;

  type Numeric_Date_Separator is ('-', '.', '/');

  Standard_Numeric_Separator: Numeric_Date_Separator := '.';

  -- Text Formats:

  type Text_Date_Format is (Day_Month_Year,
                            Month_Day_Year);

  Standard_Text_Date_Format: Text_Date_Format := Day_Month_Year;

  type Text_Date_Separator is (None, English_Ordinal, '.');

  Standard_Text_Date_Separator: Text_Date_Separator := '.';

  type Month_Names is array (Calendar.Month_Number) of Unbounded_String;

  Standard_Names: Month_Names := (To_Unbounded_String ("January"),  
                                  To_Unbounded_String ("February"),  
                                  To_Unbounded_String ("March"),  
                                  To_Unbounded_String ("April"),  
                                  To_Unbounded_String ("May"),  
                                  To_Unbounded_String ("June"),  
                                  To_Unbounded_String ("July"),  
                                  To_Unbounded_String ("August"),  
                                  To_Unbounded_String ("September"),  
                                  To_Unbounded_String ("October"),  
                                  To_Unbounded_String ("November"),  
                                  To_Unbounded_String ("December"));

end Calendar_Format;
------------------------------------------------------------------------
package Calendar_Format.Numeric is

  --====================================================================
  -- Author    Christoph Grein
  -- Version   0.0
  -- Date      15 March 2001
  --====================================================================
  -- Calculate the date image in the requested format.
  --
  -- There are two overloaded functions: One takes a Calendar.Time as
  -- input, the other a year, month and day number.
  --====================================================================
  -- History
  -- Author Version   Date    Reason for change
  --  C.G.    0.0  15.03.2001 PDL
  --====================================================================

  function Date_Image (Date     : Calendar.Time;
                       Format   : Numeric_Date_Format    := 
Standard_Numeric_Date_Format;
                       Separator: Numeric_Date_Separator := 
Standard_Numeric_Separator) return String;
  function Date_Image (Year     : Calendar.Year_Number;
                       Month    : Calendar.Month_Number;
                       Day      : Calendar.Day_Number;
                       Format   : Numeric_Date_Format    := 
Standard_Numeric_Date_Format;
                       Separator: Numeric_Date_Separator := 
Standard_Numeric_Separator) return String;

end Calendar_Format.Numeric;
------------------------------------------------------------------------
package Calendar_Format.Text is

  --====================================================================
  -- Author    Christoph Grein
  -- Version   0.0
  -- Date      15 March 2001
  --====================================================================
  -- Calculate the date image in the requested format.
  --
  -- There are two overloaded functions: One takes a Calendar.Time as
  -- input, the other a year, month and day number.
  --====================================================================
  -- History
  -- Author Version   Date    Reason for change
  --  C.G.    0.0  15.03.2001 PDL
  --====================================================================

  function Date_Image (Date     : Calendar.Time;
                       Format   : Text_Date_Format    := 
Standard_Text_Date_Format;
                       Separator: Text_Date_Separator := 
Standard_Text_Date_Separator;
                       Names    : Month_Names         := Standard_Names) return 
String;
  function Date_Image (Year     : Calendar.Year_Number;
                       Month    : Calendar.Month_Number;
                       Day      : Calendar.Day_Number;
                       Format   : Text_Date_Format    := 
Standard_Text_Date_Format;
                       Separator: Text_Date_Separator := 
Standard_Text_Date_Separator;
                       Names    : Month_Names         := Standard_Names) return 
String;

end Calendar_Format.Text;





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

* Re: calander package - Proposal for dates
       [not found] <200103160849.JAA00680@bulgaria.otn.eurocopter.de>
@ 2001-03-16  9:31 ` Hans-Olof Danielsson
  2001-03-17 20:18   ` Georg Bauhaus
  2001-03-24  6:27   ` David Thompson
  0 siblings, 2 replies; 25+ messages in thread
From: Hans-Olof Danielsson @ 2001-03-16  9:31 UTC (permalink / raw)
  To: comp.lang.ada

I think there is an ISO standard for date and time format with one of the
formats being something like this:
2001-03-16  10:25:29
If there is such a standard format, it should be coverd by the package.

HOD
----- Original Message -----
From: "Christoph Grein" <christoph.grein@eurocopter.de>
To: <comp.lang.ada@ada.eu.org>
Sent: Friday, March 16, 2001 9:49 AM
Subject: Re: calander package - Proposal for dates


> I've created a set of packages with specification. There's also
> an implementation with test program.
> It's not perfect (it's only for dates, not for times, and the Is_Leap_Year
> function is maybe misplaced) but it might serve as a start.
> I use two child packages, because otherwise the functions are not
resolvable
> when defaults are used.
> (The mailer might ruin the indentation.)
> ------------------------------------------------------------------------
> with Ada.Calendar;
> with Ada.Strings.Unbounded;
> use  Ada.Strings.Unbounded;
>
> package Calendar_Format is
>
>   --====================================================================
>   -- Author    Christoph Grein
>   -- Version   0.0
>   -- Date      15 March 2001
>   --====================================================================
>   -- Various date formats are defined.
>   --
>   -- Numeric formats consists of all numbers for days, months, and
>   -- years.
>   -- Text formats use names for months. To allow for language specific
>   -- names, they are defined with a (non-constant) array of (unbounded)
>   -- strings.
>   --
>   -- Numeric Formats:
>   -- ----------------
>   --
>   -- These formats are described by enumeration literals where D stands
>   -- for a day digit, M for a month digit, and Y for a year digit.
>   -- A single character D or M signifies that only as much digits will
>   -- be used as needed, DD or MM signifies that always two digits will
>   -- be used.
>   -- YYYY signifies that all four digits of a year will be used, YY
>   -- signifies the abbreviate form.
>   --
>   -- Examples:
>   --
>   --   10-12-1815 Lady Ada's birthday with
>   --              DD_MM_YYYY and '-' separator
>   --   12/10/80   First Ada Standard DOD-MIL-STD 1815 with
>   --              MM_DD_YY and '/' separator
>   --   1.1.2001   The begin of the new millenium with
>   --              D_M_YYYY or M_D_YYYY and '.' separator
>   --   01.01.01   The same date with with DD_MM_YY or MM_DD_YY
>   --
>   -- Text Formats:
>   -- -------------
>   --
>   -- There are tow formats differing only in the placement of day and
>   -- month. In day, month, year sequence, the values are separated by
>   -- one blank character, in month, day, year sequence, an additional
>   -- comma is inserted between day and year value. The day value uses
>   -- one or two digits as appropriate.
>   -- Additionally an ordinal separator may be inserted after the day
>   -- value.
>   --
>   -- Examples:
>   --
>   -- 10 December 1815    Day_Month_Year with None separator
>   -- 10. December 1980   Day_Month_Year with '.' separator
>   -- December 10, 1980   Month_Day_Year with None separator
>   -- December 10th, 1980 Month_Day_Year with English_Ordinal separator
>   -- 1st January 2001    Day_Month_Year with English_Ordinal separator
>   --====================================================================
>   -- History
>   -- Author Version   Date    Reason for change
>   --  C.G.    0.0  15.03.2001 PDL
>   --====================================================================
>
>   use Ada;
>
>   function Is_Leap_Year (Year: Calendar.Year_Number) return Boolean;
>
>   -- Numeric Formats:
>
>   type Numeric_Date_Format is (D_M_YY,
>                                D_M_YYYY,
>                                DD_MM_YY,
>                                DD_MM_YYYY,
>                                MM_DD_YY,
>                                MM_DD_YYYY,
>                                YYYY_MM_DD);
>
>   Standard_Numeric_Date_Format: Numeric_Date_Format := D_M_YYYY;
>
>   type Numeric_Date_Separator is ('-', '.', '/');
>
>   Standard_Numeric_Separator: Numeric_Date_Separator := '.';
>
>   -- Text Formats:
>
>   type Text_Date_Format is (Day_Month_Year,
>                             Month_Day_Year);
>
>   Standard_Text_Date_Format: Text_Date_Format := Day_Month_Year;
>
>   type Text_Date_Separator is (None, English_Ordinal, '.');
>
>   Standard_Text_Date_Separator: Text_Date_Separator := '.';
>
>   type Month_Names is array (Calendar.Month_Number) of Unbounded_String;
>
>   Standard_Names: Month_Names := (To_Unbounded_String ("January"),
>                                   To_Unbounded_String ("February"),
>                                   To_Unbounded_String ("March"),
>                                   To_Unbounded_String ("April"),
>                                   To_Unbounded_String ("May"),
>                                   To_Unbounded_String ("June"),
>                                   To_Unbounded_String ("July"),
>                                   To_Unbounded_String ("August"),
>                                   To_Unbounded_String ("September"),
>                                   To_Unbounded_String ("October"),
>                                   To_Unbounded_String ("November"),
>                                   To_Unbounded_String ("December"));
>
> end Calendar_Format;
> ------------------------------------------------------------------------
> package Calendar_Format.Numeric is
>
>   --====================================================================
>   -- Author    Christoph Grein
>   -- Version   0.0
>   -- Date      15 March 2001
>   --====================================================================
>   -- Calculate the date image in the requested format.
>   --
>   -- There are two overloaded functions: One takes a Calendar.Time as
>   -- input, the other a year, month and day number.
>   --====================================================================
>   -- History
>   -- Author Version   Date    Reason for change
>   --  C.G.    0.0  15.03.2001 PDL
>   --====================================================================
>
>   function Date_Image (Date     : Calendar.Time;
>                        Format   : Numeric_Date_Format    :=
> Standard_Numeric_Date_Format;
>                        Separator: Numeric_Date_Separator :=
> Standard_Numeric_Separator) return String;
>   function Date_Image (Year     : Calendar.Year_Number;
>                        Month    : Calendar.Month_Number;
>                        Day      : Calendar.Day_Number;
>                        Format   : Numeric_Date_Format    :=
> Standard_Numeric_Date_Format;
>                        Separator: Numeric_Date_Separator :=
> Standard_Numeric_Separator) return String;
>
> end Calendar_Format.Numeric;
> ------------------------------------------------------------------------
> package Calendar_Format.Text is
>
>   --====================================================================
>   -- Author    Christoph Grein
>   -- Version   0.0
>   -- Date      15 March 2001
>   --====================================================================
>   -- Calculate the date image in the requested format.
>   --
>   -- There are two overloaded functions: One takes a Calendar.Time as
>   -- input, the other a year, month and day number.
>   --====================================================================
>   -- History
>   -- Author Version   Date    Reason for change
>   --  C.G.    0.0  15.03.2001 PDL
>   --====================================================================
>
>   function Date_Image (Date     : Calendar.Time;
>                        Format   : Text_Date_Format    :=
> Standard_Text_Date_Format;
>                        Separator: Text_Date_Separator :=
> Standard_Text_Date_Separator;
>                        Names    : Month_Names         := Standard_Names)
return
> String;
>   function Date_Image (Year     : Calendar.Year_Number;
>                        Month    : Calendar.Month_Number;
>                        Day      : Calendar.Day_Number;
>                        Format   : Text_Date_Format    :=
> Standard_Text_Date_Format;
>                        Separator: Text_Date_Separator :=
> Standard_Text_Date_Separator;
>                        Names    : Month_Names         := Standard_Names)
return
> String;
>
> end Calendar_Format.Text;
>
>
> _______________________________________________
> comp.lang.ada mailing list
> comp.lang.ada@ada.eu.org
> http://ada.eu.org/mailman/listinfo/comp.lang.ada






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

* Re: calander package - Proposal for dates
  2001-03-16  8:49 Christoph Grein
@ 2001-03-16 17:21 ` Robert A Duff
  2001-03-17  2:55 ` Jeffrey Carter
  1 sibling, 0 replies; 25+ messages in thread
From: Robert A Duff @ 2001-03-16 17:21 UTC (permalink / raw)


Christoph Grein <christoph.grein@eurocopter.de> writes:

>   Standard_Names: Month_Names := (To_Unbounded_String ("January"),  
>                                   To_Unbounded_String ("February"),  
>                                   To_Unbounded_String ("March"),  
>                                   To_Unbounded_String ("April"),  
>...

Why not use an enumerated type, and use 'Image to map to strings?
(You have to write a Capitalize function if you don't like shouting.)

- Bob



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

* RE: calander package - Proposal for dates
       [not found] <000201c0ae3b$b27cca00$039697d4@d1>
@ 2001-03-16 23:46 ` Robert C. Leif, Ph.D.
  0 siblings, 0 replies; 25+ messages in thread
From: Robert C. Leif, Ph.D. @ 2001-03-16 23:46 UTC (permalink / raw)
  To: comp.lang.ada

From: Bob Leif
To: Hans-Olof Danielsson et al.
The time and date types for XML should also be included.

-----Original Message-----
From: comp.lang.ada-admin@ada.eu.org
[mailto:comp.lang.ada-admin@ada.eu.org]On Behalf Of Hans-Olof Danielsson
Sent: Friday, March 16, 2001 1:31 AM
To: comp.lang.ada@ada.eu.org
Subject: Re: calander package - Proposal for dates


I think there is an ISO standard for date and time format with one of the
formats being something like this:
2001-03-16  10:25:29
If there is such a standard format, it should be coverd by the package.

HOD
----- Original Message -----
From: "Christoph Grein" <christoph.grein@eurocopter.de>
To: <comp.lang.ada@ada.eu.org>
Sent: Friday, March 16, 2001 9:49 AM
Subject: Re: calander package - Proposal for dates


> I've created a set of packages with specification. There's also
> an implementation with test program.
> It's not perfect (it's only for dates, not for times, and the Is_Leap_Year
> function is maybe misplaced) but it might serve as a start.
> I use two child packages, because otherwise the functions are not
resolvable
> when defaults are used.
> (The mailer might ruin the indentation.)
> ------------------------------------------------------------------------
> with Ada.Calendar;
> with Ada.Strings.Unbounded;
> use  Ada.Strings.Unbounded;
>
> package Calendar_Format is
>
>   --====================================================================
>   -- Author    Christoph Grein
>   -- Version   0.0
>   -- Date      15 March 2001
>   --====================================================================
>   -- Various date formats are defined.
>   --
>   -- Numeric formats consists of all numbers for days, months, and
>   -- years.
>   -- Text formats use names for months. To allow for language specific
>   -- names, they are defined with a (non-constant) array of (unbounded)
>   -- strings.
>   --
>   -- Numeric Formats:
>   -- ----------------
>   --
>   -- These formats are described by enumeration literals where D stands
>   -- for a day digit, M for a month digit, and Y for a year digit.
>   -- A single character D or M signifies that only as much digits will
>   -- be used as needed, DD or MM signifies that always two digits will
>   -- be used.
>   -- YYYY signifies that all four digits of a year will be used, YY
>   -- signifies the abbreviate form.
>   --
>   -- Examples:
>   --
>   --   10-12-1815 Lady Ada's birthday with
>   --              DD_MM_YYYY and '-' separator
>   --   12/10/80   First Ada Standard DOD-MIL-STD 1815 with
>   --              MM_DD_YY and '/' separator
>   --   1.1.2001   The begin of the new millenium with
>   --              D_M_YYYY or M_D_YYYY and '.' separator
>   --   01.01.01   The same date with with DD_MM_YY or MM_DD_YY
>   --
>   -- Text Formats:
>   -- -------------
>   --
>   -- There are tow formats differing only in the placement of day and
>   -- month. In day, month, year sequence, the values are separated by
>   -- one blank character, in month, day, year sequence, an additional
>   -- comma is inserted between day and year value. The day value uses
>   -- one or two digits as appropriate.
>   -- Additionally an ordinal separator may be inserted after the day
>   -- value.
>   --
>   -- Examples:
>   --
>   -- 10 December 1815    Day_Month_Year with None separator
>   -- 10. December 1980   Day_Month_Year with '.' separator
>   -- December 10, 1980   Month_Day_Year with None separator
>   -- December 10th, 1980 Month_Day_Year with English_Ordinal separator
>   -- 1st January 2001    Day_Month_Year with English_Ordinal separator
>   --====================================================================
>   -- History
>   -- Author Version   Date    Reason for change
>   --  C.G.    0.0  15.03.2001 PDL
>   --====================================================================
>
>   use Ada;
>
>   function Is_Leap_Year (Year: Calendar.Year_Number) return Boolean;
>
>   -- Numeric Formats:
>
>   type Numeric_Date_Format is (D_M_YY,
>                                D_M_YYYY,
>                                DD_MM_YY,
>                                DD_MM_YYYY,
>                                MM_DD_YY,
>                                MM_DD_YYYY,
>                                YYYY_MM_DD);
>
>   Standard_Numeric_Date_Format: Numeric_Date_Format := D_M_YYYY;
>
>   type Numeric_Date_Separator is ('-', '.', '/');
>
>   Standard_Numeric_Separator: Numeric_Date_Separator := '.';
>
>   -- Text Formats:
>
>   type Text_Date_Format is (Day_Month_Year,
>                             Month_Day_Year);
>
>   Standard_Text_Date_Format: Text_Date_Format := Day_Month_Year;
>
>   type Text_Date_Separator is (None, English_Ordinal, '.');
>
>   Standard_Text_Date_Separator: Text_Date_Separator := '.';
>
>   type Month_Names is array (Calendar.Month_Number) of Unbounded_String;
>
>   Standard_Names: Month_Names := (To_Unbounded_String ("January"),
>                                   To_Unbounded_String ("February"),
>                                   To_Unbounded_String ("March"),
>                                   To_Unbounded_String ("April"),
>                                   To_Unbounded_String ("May"),
>                                   To_Unbounded_String ("June"),
>                                   To_Unbounded_String ("July"),
>                                   To_Unbounded_String ("August"),
>                                   To_Unbounded_String ("September"),
>                                   To_Unbounded_String ("October"),
>                                   To_Unbounded_String ("November"),
>                                   To_Unbounded_String ("December"));
>
> end Calendar_Format;
> ------------------------------------------------------------------------
> package Calendar_Format.Numeric is
>
>   --====================================================================
>   -- Author    Christoph Grein
>   -- Version   0.0
>   -- Date      15 March 2001
>   --====================================================================
>   -- Calculate the date image in the requested format.
>   --
>   -- There are two overloaded functions: One takes a Calendar.Time as
>   -- input, the other a year, month and day number.
>   --====================================================================
>   -- History
>   -- Author Version   Date    Reason for change
>   --  C.G.    0.0  15.03.2001 PDL
>   --====================================================================
>
>   function Date_Image (Date     : Calendar.Time;
>                        Format   : Numeric_Date_Format    :=
> Standard_Numeric_Date_Format;
>                        Separator: Numeric_Date_Separator :=
> Standard_Numeric_Separator) return String;
>   function Date_Image (Year     : Calendar.Year_Number;
>                        Month    : Calendar.Month_Number;
>                        Day      : Calendar.Day_Number;
>                        Format   : Numeric_Date_Format    :=
> Standard_Numeric_Date_Format;
>                        Separator: Numeric_Date_Separator :=
> Standard_Numeric_Separator) return String;
>
> end Calendar_Format.Numeric;
> ------------------------------------------------------------------------
> package Calendar_Format.Text is
>
>   --====================================================================
>   -- Author    Christoph Grein
>   -- Version   0.0
>   -- Date      15 March 2001
>   --====================================================================
>   -- Calculate the date image in the requested format.
>   --
>   -- There are two overloaded functions: One takes a Calendar.Time as
>   -- input, the other a year, month and day number.
>   --====================================================================
>   -- History
>   -- Author Version   Date    Reason for change
>   --  C.G.    0.0  15.03.2001 PDL
>   --====================================================================
>
>   function Date_Image (Date     : Calendar.Time;
>                        Format   : Text_Date_Format    :=
> Standard_Text_Date_Format;
>                        Separator: Text_Date_Separator :=
> Standard_Text_Date_Separator;
>                        Names    : Month_Names         := Standard_Names)
return
> String;
>   function Date_Image (Year     : Calendar.Year_Number;
>                        Month    : Calendar.Month_Number;
>                        Day      : Calendar.Day_Number;
>                        Format   : Text_Date_Format    :=
> Standard_Text_Date_Format;
>                        Separator: Text_Date_Separator :=
> Standard_Text_Date_Separator;
>                        Names    : Month_Names         := Standard_Names)
return
> String;
>
> end Calendar_Format.Text;
>
>
> _______________________________________________
> comp.lang.ada mailing list
> comp.lang.ada@ada.eu.org
> http://ada.eu.org/mailman/listinfo/comp.lang.ada








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

* Re: calander package - Proposal for dates
  2001-03-16  8:49 Christoph Grein
  2001-03-16 17:21 ` Robert A Duff
@ 2001-03-17  2:55 ` Jeffrey Carter
  2001-03-17 10:16   ` Pascal Obry
  2001-03-19 16:07   ` Marin David Condic
  1 sibling, 2 replies; 25+ messages in thread
From: Jeffrey Carter @ 2001-03-17  2:55 UTC (permalink / raw)


This proposal limits you to a fixed set of formats. If the format you
need is not in that set, you are out of luck.

I'm toying with providing image functions for the individual parts of a
date or time. This would allow the client to combine them in any manner
desired. I'm currently chewing on what to do with the am/pm part of a
12-hour hour. When I come up with something usable I'll post it here for
comment.

-- 
Jeff Carter
"I waggle my private parts at your aunties."
Monty Python & the Holy Grail



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

* Re: calander package - Proposal for dates
  2001-03-17  2:55 ` Jeffrey Carter
@ 2001-03-17 10:16   ` Pascal Obry
  2001-03-17 18:11     ` Ehud Lamm
  2001-03-19 22:03     ` Jeffrey Carter
  2001-03-19 16:07   ` Marin David Condic
  1 sibling, 2 replies; 25+ messages in thread
From: Pascal Obry @ 2001-03-17 10:16 UTC (permalink / raw)



Jeffrey Carter <jrcarter@acm.org> writes:

> This proposal limits you to a fixed set of formats. If the format you
> need is not in that set, you are out of luck.

Indeed. Please have a look at the GNAT.Calendar.Time_IO package which is very
flexible. Well let me post the spec of GNAT.Calendar and
GNAT.Calendar.Time_IO. These are certainly a good start for this discussion :)

<<
------------------------------------------------------------------------------
--                                                                          --
--                         GNAT RUN-TIME COMPONENTS                         --
--                                                                          --
--                         G N A T . C A L E N D A R                        --
--                                                                          --
--                                 S p e c                                  --
--                                                                          --
--                            $Revision: 1.4 $
--                                                                          --
--          Copyright (C) 1999-2000 Free Software Foundation, Inc.          --
--                                                                          --
-- GNAT is free software;  you can  redistribute it  and/or modify it under --
-- terms of the  GNU General Public License as published  by the Free Soft- --
-- ware  Foundation;  either version 2,  or (at your option) any later ver- --
-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
-- for  more details.  You should have  received  a copy of the GNU General --
-- Public License  distributed with GNAT;  see file COPYING.  If not, write --
-- to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
-- MA 02111-1307, USA.                                                      --
--                                                                          --
-- As a special exception,  if other files  instantiate  generics from this --
-- unit, or you link  this unit with other files  to produce an executable, --
-- this  unit  does not  by itself cause  the resulting  executable  to  be --
-- covered  by the  GNU  General  Public  License.  This exception does not --
-- however invalidate  any other reasons why  the executable file  might be --
-- covered by the  GNU Public License.                                      --
--                                                                          --
-- GNAT was originally developed  by the GNAT team at  New York University. --
-- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
--                                                                          --
------------------------------------------------------------------------------

--  This package extends Ada.Calendar to handle Hour, Minute, Second,
--  Second_Duration and Day_Of_Week and Day_In_Year from Calendar.Time.
--  Second_Duration precision depends on the target clock precision.
--
--  GNAT.Calendar provides the same kind of abstraction found in
--  Ada.Calendar. It provides Split and Time_Of to build and split a Time
--  data. And it provides accessor functions to get only one of Hour, Minute,
--  Second, Second_Duration. Other functions are to access more advanced
--  valueas like Day_Of_Week, Day_In_Year and Week_In_Year.

with Ada.Calendar;
with Interfaces.C;

package GNAT.Calendar is

   type Day_Name is
     (Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday);

   subtype Hour_Number         is Natural range 0 .. 23;
   subtype Minute_Number       is Natural range 0 .. 59;
   subtype Second_Number       is Natural range 0 .. 59;
   subtype Second_Duration     is Ada.Calendar.Day_Duration range 0.0 .. 1.0;
   subtype Day_In_Year_Number  is Positive range 1 .. 366;
   subtype Week_In_Year_Number is Positive range 1 .. 53;

   function Hour        (Date : Ada.Calendar.Time) return Hour_Number;
   function Minute      (Date : Ada.Calendar.Time) return Minute_Number;
   function Second      (Date : Ada.Calendar.Time) return Second_Number;
   function Sub_Second  (Date : Ada.Calendar.Time) return Second_Duration;
   --  Hour, Minute, Sedond and Sub_Second returns the complete time data for
   --  the Date (H:M:S.SS). See Ada.Calendar for Year, Month, Day accessors.
   --  Second_Duration precision depends on the target clock precision.

   function Day_Of_Week (Date : Ada.Calendar.Time) return Day_Name;
   --  Return the day name.

   function Day_In_Year (Date : Ada.Calendar.Time) return Day_In_Year_Number;
   --  Returns the day number in the year. (1st January is day 1 and 31st
   --  December is day 365 or 366 for leap year).

   function Week_In_Year (Date : Ada.Calendar.Time) return Week_In_Year_Number;
   --  Returns the week number in the year with Monday as first day of week

   procedure Split
     (Date       : Ada.Calendar.Time;
      Year       : out Ada.Calendar.Year_Number;
      Month      : out Ada.Calendar.Month_Number;
      Day        : out Ada.Calendar.Day_Number;
      Hour       : out Hour_Number;
      Minute     : out Minute_Number;
      Second     : out Second_Number;
      Sub_Second : out Second_Duration);
   --  Split the standard Ada.Calendar.Time data in date data (Year, Month,
   --  Day) and Time data (Hour, Minute, Second, Sub_Second)

   function Time_Of
     (Year       : Ada.Calendar.Year_Number;
      Month      : Ada.Calendar.Month_Number;
      Day        : Ada.Calendar.Day_Number;
      Hour       : Hour_Number;
      Minute     : Minute_Number;
      Second     : Second_Number;
      Sub_Second : Second_Duration := 0.0)
      return Ada.Calendar.Time;
   --  Returns an Ada.Calendar.Time data built from the date and time values.

   --  C timeval conversion

   --  C timeval represent a duration (used in Select for example). This
   --  structure is composed of a number of seconds and a number of micro
   --  seconds. The timeval structure is not exposed here because its
   --  definition is target dependent. Interface to C programs is done via a
   --  pointer to timeval structure.

   type timeval is private;

   function To_Duration (T : access timeval) return Duration;
   function To_Timeval  (D : Duration) return timeval;

private
   --  This is a dummy declaration that should be the largest possible timeval
   --  structure of all supported targets.

   type timeval is array (1 .. 2) of Interfaces.C.long;

   function Julian_Day
     (Year  : Ada.Calendar.Year_Number;
      Month : Ada.Calendar.Month_Number;
      Day   : Ada.Calendar.Day_Number)
      return  Integer;
   --  Compute Julian day number.
   --
   --  The code of this function is a modified version of algorithm
   --  199 from the Collected Algorithms of the ACM.
   --  The author of algorithm 199 is Robert G. Tantzen.
end GNAT.Calendar;
>>


<<
------------------------------------------------------------------------------
--                                                                          --
--                         GNAT RUN-TIME COMPONENTS                         --
--                                                                          --
--                G N A T . C A L E N D A R . T I M E _ I O                 --
--                                                                          --
--                                 S p e c                                  --
--                                                                          --
--                            $Revision: 1.3 $
--                                                                          --
--              Copyright (C) 1999 Ada Core Technologies, Inc.              --
--                                                                          --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
-- apply solely to the  contents of the part following the private keyword. --
--                                                                          --
-- GNAT is free software;  you can  redistribute it  and/or modify it under --
-- terms of the  GNU General Public License as published  by the Free Soft- --
-- ware  Foundation;  either version 2,  or (at your option) any later ver- --
-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
-- for  more details.  You should have  received  a copy of the GNU General --
-- Public License  distributed with GNAT;  see file COPYING.  If not, write --
-- to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
-- MA 02111-1307, USA.                                                      --
--                                                                          --
-- As a special exception,  if other files  instantiate  generics from this --
-- unit, or you link  this unit with other files  to produce an executable, --
-- this  unit  does not  by itself cause  the resulting  executable  to  be --
-- covered  by the  GNU  General  Public  License.  This exception does not --
-- however invalidate  any other reasons why  the executable file  might be --
-- covered by the  GNU Public License.                                      --
--                                                                          --
-- GNAT was originally developed  by the GNAT team at  New York University. --
-- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
--                                                                          --
------------------------------------------------------------------------------

--  This package augments standard Ada.Text_IO with facilities for input
--  and output of time values in standardized format.

package GNAT.Calendar.Time_IO is

   Picture_Error : exception;

   type Picture_String is new String;

   --  This is a string to describe date and time output format. The string is
   --  a set of standard character and special tag that are replaced by the
   --  corresponding values. It follows the GNU Date specification. Here are
   --  the recognized directives :
   --
   --          %    a literal %
   --          n    a newline
   --          t    a horizontal tab
   --
   --          Time fields:
   --
   --          %H   hour (00..23)
   --          %I   hour (01..12)
   --          %k   hour ( 0..23)
   --          %l   hour ( 1..12)
   --          %M   minute (00..59)
   --          %p   locale's AM or PM
   --          %r   time, 12-hour (hh:mm:ss [AP]M)
   --          %s   seconds  since 1970-01-01  00:00:00 UTC
   --                (a nonstandard extension)
   --          %S   second (00..59)
   --          %T   time, 24-hour (hh:mm:ss)
   --
   --          Date fields:
   --
   --          %a   locale's abbreviated weekday name (Sun..Sat)
   --          %A   locale's    full   weekday   name,    variable   length
   --                  (Sunday..Saturday)
   --          %b   locale's abbreviated month name (Jan..Dec)
   --          %B   locale's    full    month    name,   variable    length
   --                  (January..December)
   --          %c   locale's date and time (Sat Nov 04 12:02:33 EST 1989)
   --          %d   day of month (01..31)
   --          %D   date (mm/dd/yy)
   --          %h   same as %b
   --          %j   day of year (001..366)
   --          %m   month (01..12)
   --          %U   week number  of year with  Sunday as first day  of week
   --                  (00..53)
   --          %w   day of week (0..6) with 0 corresponding to Sunday
   --          %W   week number  of year with  Monday as first day  of week
   --                  (00..53)
   --          %x   locale's date representation (mm/dd/yy)
   --          %y   last two digits of year (00..99)
   --          %Y   year (1970...)
   --
   --          By default,  date pads numeric fields with zeroes.  GNU date
   --          recognizes the following nonstandard numeric modifiers:
   --
   --          -    (hyphen) do not pad the field
   --          _    (underscore) pad the field with spaces


   ISO_Date      : constant Picture_String;
   US_Date       : constant Picture_String;
   European_Date : constant Picture_String;

   function Image
     (Date    : Ada.Calendar.Time;
      Picture : Picture_String)
      return    String;
   --  Return Date as a string with format Picture.
   --  raise Picture_Error if picture string is wrong

   procedure Put_Time
     (Date    : Ada.Calendar.Time;
      Picture : Picture_String);
   --  Put Date with format Picture.
   --  raise Picture_Error if picture string is wrong

private
   ISO_Date      : constant Picture_String := "%Y/%m/%d";
   US_Date       : constant Picture_String := "%m/%d/%y";
   European_Date : constant Picture_String := "%d/%m/%y";

end GNAT.Calendar.Time_IO;
>>

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|         http://perso.wanadoo.fr/pascal.obry
--|
--| "The best way to travel is by means of imagination"



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

* Re: calander package - Proposal for dates
  2001-03-17 10:16   ` Pascal Obry
@ 2001-03-17 18:11     ` Ehud Lamm
  2001-03-19 14:26       ` Ted Dennison
  2001-03-20  6:30       ` Wilhelm Spickermann
  2001-03-19 22:03     ` Jeffrey Carter
  1 sibling, 2 replies; 25+ messages in thread
From: Ehud Lamm @ 2001-03-17 18:11 UTC (permalink / raw)


I also suggest reviewing the Java date libraries (Calendar, Date and
DateFormat).

One little thing that seems to be forgotten all too often is that defining
weekdays, you must remember that in some parts of the world the first work
day is Sunday, and not Monday...

Ehud Lamm





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

* Re: calander package - Proposal for dates
  2001-03-16  9:31 ` Hans-Olof Danielsson
@ 2001-03-17 20:18   ` Georg Bauhaus
  2001-03-24  6:27   ` David Thompson
  1 sibling, 0 replies; 25+ messages in thread
From: Georg Bauhaus @ 2001-03-17 20:18 UTC (permalink / raw)


Hans-Olof Danielsson (Hans-Olof.Danielsson@swipnet.se) wrote:
: I think there is an ISO standard for date and time format with one of the
: formats being something like this:
: 2001-03-16  10:25:29

The C DateCalc library for Gregorian date calculations,
description at (and featuring /* in */ and /* out */
for C function parameters :-)
http://search.cpan.org/doc/STBEY/Date-Calc-4.3/Calc.pm
also has some pointers to relevant standards.



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

* Re: calander package - Proposal for dates
@ 2001-03-19  6:50 Christoph Grein
  0 siblings, 0 replies; 25+ messages in thread
From: Christoph Grein @ 2001-03-19  6:50 UTC (permalink / raw)
  To: comp.lang.ada

Robert A Duff <bobduff@world.std.com> wrote:
> Christoph Grein <christoph.grein@eurocopter.de> writes:
> 
> >   Standard_Names: Month_Names := (To_Unbounded_String ("January"),  
> >                                   To_Unbounded_String ("February"),  
> >                                   To_Unbounded_String ("March"),  
> >                                   To_Unbounded_String ("April"),  
> >...
> 
> Why not use an enumerated type, and use 'Image to map to strings?
> (You have to write a Capitalize function if you don't like shouting.)
> 
> - Bob

I thought it was clear:

  -- Text formats use names for months. To allow for language specific
  -- names, they are defined with a (non-constant) array of (unbounded)
  -- strings.

How else can you provide for French, German, Italian ... names?

Christoph





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

* Re: calander package - Proposal for dates
  2001-03-17 18:11     ` Ehud Lamm
@ 2001-03-19 14:26       ` Ted Dennison
  2001-03-19 17:30         ` Ehud Lamm
  2001-03-20  6:30       ` Wilhelm Spickermann
  1 sibling, 1 reply; 25+ messages in thread
From: Ted Dennison @ 2001-03-19 14:26 UTC (permalink / raw)


In article <9909kc$d7v$1@news.huji.ac.il>, Ehud Lamm says...
>
>I also suggest reviewing the Java date libraries (Calendar, Date and
>DateFormat).
>
>One little thing that seems to be forgotten all too often is that defining
>weekdays, you must remember that in some parts of the world the first work
>day is Sunday, and not Monday...

..and in some parts of the world, the first work day is not spelled with
Latin_1 characters. Where do you draw the line? Where could you draw the line
that everyone would agree?

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



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

* Re: calander package - Proposal for dates
  2001-03-17  2:55 ` Jeffrey Carter
  2001-03-17 10:16   ` Pascal Obry
@ 2001-03-19 16:07   ` Marin David Condic
  2001-03-19 17:24     ` Ted Dennison
  1 sibling, 1 reply; 25+ messages in thread
From: Marin David Condic @ 2001-03-19 16:07 UTC (permalink / raw)


Well, the problem is this: If you *don't* want to limit things to some fixed
set of formats, you're only going to invent some programming language for
"rolling your own". Maybe it would be a tad easier than simply using Ada
features, but ultimately, it will be some kind of programming task. At that
point, you have to ask: "Why not just rely on Ada to do it?"

I've coded a bunch of date/time-to-string formatting routines with Ada and
they are generally pretty small. If you were to provide some flavor of
'Image for date/time pieces, it might make things a bit more efficient, but
I don't know that it would be big enough to make much difference. (You can
already get the 'Image of the pieces after you convert the time to numeric
pieces. Seems like at best you can eliminate one step.)

OTOH, if the package Calendar (or some child) had some Image functions that
gave you back strings of the form "January" and "1941" and such, it might be
enough of a language extension to eliminate any further need for additional
packages. Hmmmmmmmmm...............

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/



"Jeffrey Carter" <jrcarter@acm.org> wrote in message
news:3AB2D1EF.B2CA8117@acm.org...
> This proposal limits you to a fixed set of formats. If the format you
> need is not in that set, you are out of luck.
>
> I'm toying with providing image functions for the individual parts of a
> date or time. This would allow the client to combine them in any manner
> desired. I'm currently chewing on what to do with the am/pm part of a
> 12-hour hour. When I come up with something usable I'll post it here for
> comment.
>
> --
> Jeff Carter
> "I waggle my private parts at your aunties."
> Monty Python & the Holy Grail





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

* Re: calander package - Proposal for dates
  2001-03-19 16:07   ` Marin David Condic
@ 2001-03-19 17:24     ` Ted Dennison
  2001-03-19 17:34       ` Ehud Lamm
  0 siblings, 1 reply; 25+ messages in thread
From: Ted Dennison @ 2001-03-19 17:24 UTC (permalink / raw)


In article <995asr$m34$1@nh.pace.co.uk>, Marin David Condic says...
>
>Well, the problem is this: If you *don't* want to limit things to some fixed
>set of formats, you're only going to invent some programming language for
>"rolling your own". Maybe it would be a tad easier than simply using Ada
..
>I've coded a bunch of date/time-to-string formatting routines with Ada and
>they are generally pretty small. If you were to provide some flavor of

That's pretty much my opinon on the subject as well. For the last version of the
SETI@Home Service I ended up having to write 2 separate time stamp routines
("DD/MM/YY HH:MM:SS" and "Month Day Year, HH:MM:SS Meridian"). It should be
pretty obvious that they coudn't share much code. The last time I wrote one
before that, it was in yet another format that included the miliseconds, since
that was a real-time system where the MS between two events could be very
important.

The only time-related thing I'd really like to see some reusable component for
would be for finding the day of the week.

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



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

* Re: calander package - Proposal for dates
  2001-03-19 14:26       ` Ted Dennison
@ 2001-03-19 17:30         ` Ehud Lamm
  0 siblings, 0 replies; 25+ messages in thread
From: Ehud Lamm @ 2001-03-19 17:30 UTC (permalink / raw)


>
> ..and in some parts of the world, the first work day is not spelled with
> Latin_1 characters. Where do you draw the line? Where could you draw the
line
> that everyone would agree?
>

Either you don't deal with localization issues at all, or you try to do a
decent job... (See how the Java packages works).

If your solution is only applicable to the US, than I guess it shouldn't be
considered standard, even in this day and age...

Ehud Lamm






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

* Re: calander package - Proposal for dates
  2001-03-19 17:24     ` Ted Dennison
@ 2001-03-19 17:34       ` Ehud Lamm
  0 siblings, 0 replies; 25+ messages in thread
From: Ehud Lamm @ 2001-03-19 17:34 UTC (permalink / raw)


Ted and Marin basically agreed:

> >I've coded a bunch of date/time-to-string formatting routines with Ada
and
> >they are generally pretty small. If you were to provide some flavor of
>
> That's pretty much my opinon on the subject as well.
>
> The only time-related thing I'd really like to see some reusable component
for
> would be for finding the day of the week.
>

I pretty much agree with this too. Maybe some other basic stuff (checking
for leap years?).
All I was saying is that IF it is decided to include things that vary from
place to place, one should try to support some flexibility.

I for one don't think dates are really all that interesting. I think UI
components (or APIs..) are much more important. But also much harder to get
right.


Ehud Lamm





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

* Re: calander package - Proposal for dates
  2001-03-17 10:16   ` Pascal Obry
  2001-03-17 18:11     ` Ehud Lamm
@ 2001-03-19 22:03     ` Jeffrey Carter
  2001-03-20 18:34       ` Pascal Obry
  1 sibling, 1 reply; 25+ messages in thread
From: Jeffrey Carter @ 2001-03-19 22:03 UTC (permalink / raw)


Pascal Obry wrote:
> 
> Jeffrey Carter <jrcarter@acm.org> writes:
> 
> > This proposal limits you to a fixed set of formats. If the format you
> > need is not in that set, you are out of luck.
> 
> Indeed. Please have a look at the GNAT.Calendar.Time_IO package which is very
> flexible. Well let me post the spec of GNAT.Calendar and
> GNAT.Calendar.Time_IO. These are certainly a good start for this discussion :)

I'm aware of and familiar with these. I find using a format string with
"%X" indicators in it somehow not in the spirit of Ada.

Jeff



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

* Re: calander package - Proposal for dates
  2001-03-17 18:11     ` Ehud Lamm
  2001-03-19 14:26       ` Ted Dennison
@ 2001-03-20  6:30       ` Wilhelm Spickermann
  2001-03-20 11:45         ` Martin Dowie
  1 sibling, 1 reply; 25+ messages in thread
From: Wilhelm Spickermann @ 2001-03-20  6:30 UTC (permalink / raw)
  To: comp.lang.ada

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=us-ascii, Size: 586 bytes --]


On 17-Mar-01 Ehud Lamm wrote:
...
> One little thing that seems to be forgotten all too often is that
> defining
> weekdays, you must remember that in some parts of the world the first
> work
> day is Sunday, and not Monday...

BTW - it�s not a regional problem. It is a common jewish and christian
practice to regard sunday as the first day of the week - as opposed to
ISO 8601. My wife expects every calendar program to be at least
switchable to sunday as first day whereas I prefer Monday in the
leftmost column (and we are living in the same part of the world :-) )

Wilhelm





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

* Re: calander package - Proposal for dates
  2001-03-20  6:30       ` Wilhelm Spickermann
@ 2001-03-20 11:45         ` Martin Dowie
  2001-03-20 13:48           ` Wilhelm Spickermann
                             ` (2 more replies)
  0 siblings, 3 replies; 25+ messages in thread
From: Martin Dowie @ 2001-03-20 11:45 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 664 bytes --]

well, I can only spoke from a Church of Scotland (Christian, Presbyterian)
background
but "on the 7th day he rested", making Monday the first day. :-)

Wilhelm Spickermann <Wilhelm.Spickermann@t-online.de> wrote in message
news:mailman.985085061.3354.comp.lang.ada@ada.eu.org...
>
[snip]
>
> BTW - it�s not a regional problem. It is a common jewish and christian
> practice to regard sunday as the first day of the week - as opposed to
> ISO 8601. My wife expects every calendar program to be at least
> switchable to sunday as first day whereas I prefer Monday in the
> leftmost column (and we are living in the same part of the world :-) )
>
> Wilhelm
>
>





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

* Re: calander package - Proposal for dates
  2001-03-20 11:45         ` Martin Dowie
@ 2001-03-20 13:48           ` Wilhelm Spickermann
  2001-03-21 13:37             ` John English
  2001-03-20 14:15           ` Marin David Condic
  2001-03-20 15:25           ` Ted Dennison
  2 siblings, 1 reply; 25+ messages in thread
From: Wilhelm Spickermann @ 2001-03-20 13:48 UTC (permalink / raw)
  To: comp.lang.ada

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=us-ascii, Size: 887 bytes --]


On 20-Mar-01 Martin Dowie wrote:
> well, I can only spoke from a Church of Scotland (Christian,
> Presbyterian)
> background
> but "on the 7th day he rested", making Monday the first day. :-)

Exactly - but that day he rested was called sabbat(=saturday) :-) . The
early christians held additional meetings on the first day of the week
to celebrate the resurrection of christ (Matthew 28.1: (please excuse
the bad translation, I don�t have an english bible) "When the sabbat was
over and the first day of the week startet, Maria Magdalena and the
other Maria came to view the grave."). When the first non-jews became
christians, they were not obliged to hold the sabbat, and so sunday
became the common holy day of christians. The idea was too, that the
important thing from the genesis was having one day of rest every
week and not on which exact day it should be held.

Wilhelm





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

* Re: calander package - Proposal for dates
  2001-03-20 11:45         ` Martin Dowie
  2001-03-20 13:48           ` Wilhelm Spickermann
@ 2001-03-20 14:15           ` Marin David Condic
  2001-03-20 15:25           ` Ted Dennison
  2 siblings, 0 replies; 25+ messages in thread
From: Marin David Condic @ 2001-03-20 14:15 UTC (permalink / raw)


Just as a point of reference, the Gregorian calendar considers Sunday to be
the first day of the week. This goes way back to early Christian practices.
The first Christians were still practicing Jews. They attended Synagog on
Saturday (which was/is the Sabbath in Jewish practice) and then gathered
together for Christian prayer, etc on Sunday - the first day of the week in
the Jewish calendar.

So at least by long standing Christian and Jewish tradition, Sunday is
considered the first day of the week. Likewise, this is carried over in the
Gregorian calendar. Obviously, for purposes of business, the *practical*
first day of the week is Monday - since that's when we have to stop having
fun and get back to work. :-)

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/


"Martin Dowie" <martin.dowie@baesystems.com> wrote in message
news:3ab74130$1@pull.gecm.com...
> well, I can only spoke from a Church of Scotland (Christian, Presbyterian)
> background
> but "on the 7th day he rested", making Monday the first day. :-)
>






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

* Re: calander package - Proposal for dates
  2001-03-20 11:45         ` Martin Dowie
  2001-03-20 13:48           ` Wilhelm Spickermann
  2001-03-20 14:15           ` Marin David Condic
@ 2001-03-20 15:25           ` Ted Dennison
  2 siblings, 0 replies; 25+ messages in thread
From: Ted Dennison @ 2001-03-20 15:25 UTC (permalink / raw)


In article <3ab74130$1@pull.gecm.com>, Martin Dowie says...
>
>well, I can only spoke from a Church of Scotland (Christian, Presbyterian)
>background
>but "on the 7th day he rested", making Monday the first day. :-)

Actually, in this country (if not in others), the "7th Day Adventists" use
similar logic to claim that Saturday is the true sabbath, not Sunday. I'm not a
theological historian, so I don't know if they have a case or not.

Boy we are getting far afield here, and without Dr. Dewar to nag us about it
too. :-(

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



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

* Re: calander package - Proposal for dates
  2001-03-19 22:03     ` Jeffrey Carter
@ 2001-03-20 18:34       ` Pascal Obry
  2001-03-20 23:01         ` Jeffrey Carter
  0 siblings, 1 reply; 25+ messages in thread
From: Pascal Obry @ 2001-03-20 18:34 UTC (permalink / raw)



Jeffrey Carter <jeffrey.carter@boeing.com> writes:

> I'm aware of and familiar with these. I find using a format string with
> "%X" indicators in it somehow not in the spirit of Ada.

Maybe but it is at least quite flexible... Do you have a better proposal ?

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|         http://perso.wanadoo.fr/pascal.obry
--|
--| "The best way to travel is by means of imagination"



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

* Re: calander package - Proposal for dates
  2001-03-20 18:34       ` Pascal Obry
@ 2001-03-20 23:01         ` Jeffrey Carter
  2001-03-21  8:17           ` Pascal Obry
  0 siblings, 1 reply; 25+ messages in thread
From: Jeffrey Carter @ 2001-03-20 23:01 UTC (permalink / raw)


Pascal Obry wrote:
> 
> Jeffrey Carter <jeffrey.carter@boeing.com> writes:
> 
> > I'm aware of and familiar with these. I find using a format string with
> > "%X" indicators in it somehow not in the spirit of Ada.
> 
> Maybe but it is at least quite flexible... Do you have a better proposal ?

See my post with subject "Date & time formatting operations for review".



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

* Re: calander package - Proposal for dates
  2001-03-20 23:01         ` Jeffrey Carter
@ 2001-03-21  8:17           ` Pascal Obry
  0 siblings, 0 replies; 25+ messages in thread
From: Pascal Obry @ 2001-03-21  8:17 UTC (permalink / raw)



Jeffrey Carter <jeffrey.carter@boeing.com> writes:

> See my post with subject "Date & time formatting operations for review".

Sorry I missed this one, my providers had a lot of trouble with the news
server recently... Could you repost it or send it to me ?

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|         http://perso.wanadoo.fr/pascal.obry
--|
--| "The best way to travel is by means of imagination"



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

* Re: calander package - Proposal for dates
  2001-03-20 13:48           ` Wilhelm Spickermann
@ 2001-03-21 13:37             ` John English
  0 siblings, 0 replies; 25+ messages in thread
From: John English @ 2001-03-21 13:37 UTC (permalink / raw)


Wilhelm Spickermann wrote:
> 
> On 20-Mar-01 Martin Dowie wrote:
> > well, I can only spoke from a Church of Scotland (Christian,
> > Presbyterian)
> > background
> > but "on the 7th day he rested", making Monday the first day. :-)
> 
> Exactly - but that day he rested was called sabbat(=saturday) :-) . The
> early christians held additional meetings on the first day of the week
> to celebrate the resurrection of christ (Matthew 28.1: (please excuse
> the bad translation, I don�t have an english bible) "When the sabbat was
> over and the first day of the week startet, Maria Magdalena and the
> other Maria came to view the grave."). When the first non-jews became
> christians, they were not obliged to hold the sabbat, and so sunday
> became the common holy day of christians. The idea was too, that the
> important thing from the genesis was having one day of rest every
> week and not on which exact day it should be held.

As an atheist, I'm a complete agnostic on this particular subject... ;-)

-----------------------------------------------------------------
 John English              | mailto:je@brighton.ac.uk
 Senior Lecturer           | http://www.it.bton.ac.uk/staff/je
 Dept. of Computing        | ** NON-PROFIT CD FOR CS STUDENTS **
 University of Brighton    |    -- see http://burks.bton.ac.uk
-----------------------------------------------------------------



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

* Re: calander package - Proposal for dates
  2001-03-16  9:31 ` Hans-Olof Danielsson
  2001-03-17 20:18   ` Georg Bauhaus
@ 2001-03-24  6:27   ` David Thompson
  1 sibling, 0 replies; 25+ messages in thread
From: David Thompson @ 2001-03-24  6:27 UTC (permalink / raw)


Hans-Olof Danielsson <Hans-Olof.Danielsson@swipnet.se> wrote :
> I think there is an ISO standard for date and time format with one of the
> formats being something like this:
> 2001-03-16  10:25:29
> If there is such a standard format, it should be coverd by the package.

ISO 8601.  But it requires representations of date-and-time
to have the date and time parts joined by a letter "T".
Lots of people don't like this and do what you show,
separate them by a space or other delimiter, but
technically while this consists of conforming 8601
representations for date and time, it is NOT a
conforming date-and-time representation.  :-{

OTOH ANSI X3.135-1992 SQL does require
"yyyy-mm-dd hh:nn:ss" with a space.

Standards are such fun.

--
- David.Thompson 1 now at worldnet.att.net






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

end of thread, other threads:[~2001-03-24  6:27 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <000201c0ae3b$b27cca00$039697d4@d1>
2001-03-16 23:46 ` calander package - Proposal for dates Robert C. Leif, Ph.D.
2001-03-19  6:50 Christoph Grein
     [not found] <200103160849.JAA00680@bulgaria.otn.eurocopter.de>
2001-03-16  9:31 ` Hans-Olof Danielsson
2001-03-17 20:18   ` Georg Bauhaus
2001-03-24  6:27   ` David Thompson
  -- strict thread matches above, loose matches on Subject: below --
2001-03-16  8:49 Christoph Grein
2001-03-16 17:21 ` Robert A Duff
2001-03-17  2:55 ` Jeffrey Carter
2001-03-17 10:16   ` Pascal Obry
2001-03-17 18:11     ` Ehud Lamm
2001-03-19 14:26       ` Ted Dennison
2001-03-19 17:30         ` Ehud Lamm
2001-03-20  6:30       ` Wilhelm Spickermann
2001-03-20 11:45         ` Martin Dowie
2001-03-20 13:48           ` Wilhelm Spickermann
2001-03-21 13:37             ` John English
2001-03-20 14:15           ` Marin David Condic
2001-03-20 15:25           ` Ted Dennison
2001-03-19 22:03     ` Jeffrey Carter
2001-03-20 18:34       ` Pascal Obry
2001-03-20 23:01         ` Jeffrey Carter
2001-03-21  8:17           ` Pascal Obry
2001-03-19 16:07   ` Marin David Condic
2001-03-19 17:24     ` Ted Dennison
2001-03-19 17:34       ` Ehud Lamm

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