Package: GNAT.Calendar.Time_IO

Description

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

Header

package GNAT.Calendar.Time_IO is
 

Exceptions

Picture_Error

Type Summary

Picture_String derived from String

Constants and Named Numbers

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

Other Items:

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


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

   --  Implementation-defined ...
end GNAT.Calendar.Time_IO;