* date format (was: Re: Confusing language...)
[not found] <199911181536.PAA06025@ns.di.fct.unl.pt>
@ 1999-11-18 0:00 ` Mario Amado Alves
1999-11-25 0:00 ` Keith Thompson
1999-12-04 0:00 ` Richard D Riehle
0 siblings, 2 replies; 3+ messages in thread
From: Mario Amado Alves @ 1999-11-18 0:00 UTC (permalink / raw)
To: Marin Condic
> Now if there were some sort of Industry Standard for storing dates/times
> externally, it might be valuable to extend Ada.Calendar with some
> conversions to do this...
There *is* a standard for *readable* time values, associated with HTML an
alike, cf. w3.org. I think there is also some standard for *binary*
representation as well, associated with telecommunications.
Package Ada.Calendar is fairly complete with respect to the resources
necessary to convert to/from any representation. The extensions could be
child packages Ada.Calendar.HTML, Ada.Calendar.IEEE (say), etc. (I assume
it possible to create children of predefined packages.) When I have this I
in my ADALIB I'll be happy to share.
| | |,| | | | |RuaFrancTaborda24RcD 2815-249CharnecaCaparica 351+212976751
| |M|A|R|I|O| | mob 219354005
| |A|M|A|D|O| |DepartmentoInformaticFCT/UNL 2825-114Caparica 351+212958536
| |A|L|V|E|S| | fax 212948541
| | | | | | | | maa@di.fct.unl.pt FCT 212948300
Sent via Deja.com http://www.deja.com/
Before you buy.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: date format (was: Re: Confusing language...)
1999-11-18 0:00 ` date format (was: Re: Confusing language...) Mario Amado Alves
@ 1999-11-25 0:00 ` Keith Thompson
1999-12-04 0:00 ` Richard D Riehle
1 sibling, 0 replies; 3+ messages in thread
From: Keith Thompson @ 1999-11-25 0:00 UTC (permalink / raw)
Mario Amado Alves <maa@di.fct.unl.pt> writes:
> There *is* a standard for *readable* time values, associated with HTML an
> alike, cf. w3.org.
I'm not sure this is what you're referring to, but the international
standard date notation is defined by ISO 8601.
The format is YYYY-MM-DD; for example, today is 1999-11-25. It's
unambiguous (unlike MM/DD/YY, or is it DD/MM/YY?), it's
language-independent, it's immune to Y2K problems, and it sorts
easily.
See <http://www.cl.cam.ac.uk/~mgk25/iso-time.html> for a good summary,
and <http://www.iso.ch/markete/8601.pdf> for the standard itself.
--
Keith Thompson (The_Other_Keith) kst@cts.com <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://www.sdsc.edu/~kst>
"Oh my gosh! You are SO ahead of your time!" -- anon.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: date format (was: Re: Confusing language...)
1999-11-18 0:00 ` date format (was: Re: Confusing language...) Mario Amado Alves
1999-11-25 0:00 ` Keith Thompson
@ 1999-12-04 0:00 ` Richard D Riehle
1 sibling, 0 replies; 3+ messages in thread
From: Richard D Riehle @ 1999-12-04 0:00 UTC (permalink / raw)
In article <Pine.LNX.4.10.9911181636120.829-100000@lexis.di.fct.unl.pt>,
Mario Amado Alves <maa@di.fct.unl.pt> wrote:
>Package Ada.Calendar is fairly complete with respect to the resources
>necessary to convert to/from any representation. The extensions could be
>child packages Ada.Calendar.HTML, Ada.Calendar.IEEE (say), etc. (I assume
>it possible to create children of predefined packages.) When I have this I
>in my ADALIB I'll be happy to share.
We have the following package that seems to work pretty well. If anyone
wants the package body, I will be happy to supply it. Or maybe we should
just send it to David Botton for his library of stuff.
-- =================================================================
-- Calendar_Formatter.Ads
-- by Richard Riehle, AdaWorks Software Engineering
-- http://www.adaworks.com
-- This package allows a client to create time in a variety of
-- formats. It is based on Ada.Calendar as defined in Chapter 9
-- of the Ada Language Reference Manual. You may first get the
-- Time using one of the two Get functions. Then get the formatted
-- time by calling one of the formatted time functions.
-- This package is not warranted by the author. There are no
-- guarantees either implied or specified. It is available for
-- experimentation and student use. If you plan to use it in any
-- production quality software, you should test it thoroughly and
-- make corrections as you require.
-- Richard Riehle
-- NOTE: Not all functions are implemented in this version. Future
-- versions will contain full implementation along with more features
-- such as child packages for doing comparisons and calculations.
-- =================================================================
package Calendar_Formatter is
type Formatted_Time is private; -- cannot be limited in this design
because
-- one function returns object of the
type and
-- requires an assignment statement
type Time_Reference is access all Formatted_Time;
type Month_1 is (January, February, March, April,
May, June, July, August,
September, October, November, December);
type Month_2 is (Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov,
Dec);
type Day_1 is (Sunday, Monday, Tuesday, Wednesday, Thursday, Friday,
Saturday);
type Day_2 is (Sun, Mon, Tue, Wed, Thu, Fri, Sat);
subtype Work_Day_1 is Day_1 range Monday..Friday;
subtype Work_Day_2 is Day_2 range Mon..Fri;
function Get_Time return Formatted_Time;
function Get_Time return Time_Reference;
function YY (FT : Formatted_Time) return String; -- two
character string for year
function YYYY (FT : Formatted_Time) return String; -- four
character string for year
function DD (FT : Formatted_Time) return String; -- two
character string for day
function MM (FT : Formatted_Time) return String; -- two
character string for month
function Hour12 (FT : Formatted_Time) return String; -- two
character string 12 hour clock hour
function AMPM (FT : Formatted_Time) return String; -- two
character string; AM or PM
function Hour24 (FT : Formatted_Time) return String; -- two
character string 24 hour clock hour
function Minute (FT : Formatted_Time) return String; -- two
character string minute
function Month (FT : Formatted_Time) return String; -- Month fully
spelled out
function Month (FT : Formatted_Time) return Month_1; -- Month in
format of the Type;
-- function Month (FT : Formatted_Time) return Month_2; -- Not yet
implemented
-- function Day (FT : Formatted_Time) return Day_1; -- Not yet
implemented
-- function Day (FT : Formatted_Time) return Day_2; -- Not yet
implemented
function Format_1 (FT : Formatted_Time) return Formatted_Time; --
Returns a copy of the private type
function Format_2 (FT : Formatted_Time) return String; -- formatted
MM-DD-YY
function Format_3 (FT : Formatted_Time) return String; -- formatted
MM-DD-YYYY HH:MM:SS
function Format_4 (FT : Formatted_Time) return String; -- e.g., July
21, 1999
function Total_Seconds (FT : Formatted_Time) return String; -- Raw number
of seconds in Time
Time_Format_Error : exception;
private
type Formatted_Time is
record
Year : String(1..4) := (others => ' ');
Month : String(1..2) := (others => ' ');
Day : String(1..2) := (others => ' ');
Hour24 : String(1..2) := (others => ' ');
Hour12 : String(1..2) := (others => ' ');
Minute : String(1..2) := (others => ' ');
Seconds : String(1..2) := (others => ' ');
AMPM : String(1..2) := (others => ' ');
Noon_Mid : String(1..8) := "Midnight"; -- or "Noon ";
Month_Name : Month_1;
Day_Name : Day_1;
Holiday : String(1..15) := (others => ' ');
end record;
end Calendar_Formatter;
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1999-12-04 0:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <199911181536.PAA06025@ns.di.fct.unl.pt>
1999-11-18 0:00 ` date format (was: Re: Confusing language...) Mario Amado Alves
1999-11-25 0:00 ` Keith Thompson
1999-12-04 0:00 ` Richard D Riehle
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox