The Ada Program: today.adb

  1 -- today.adb:  print today's date using "Ada.Calendar" package
  2 
  3 with Ada.Text_IO, Ada.Integer_Text_IO, Ada.Calendar;
  4 use Ada;
  5 
  6 procedure Today is
  7 
  8    Now     : Calendar.Time := Calendar.Clock;
  9    Year    : Calendar.Year_Number;
 10    Month   : Calendar.Month_Number;
 11    Day     : Calendar.Day_Number;
 12    Seconds : Calendar.Day_Duration;
 13 
 14 begin
 15    Calendar.Split (Now, Year, Month, Day, Seconds);
 16    Integer_Text_IO.Put (Month, Width=>2);
 17    Text_IO.Put ('/');
 18    Integer_Text_IO.Put (Day, Width=>2);
 19    Text_IO.Put ('/');
 20    Integer_Text_IO.Put (Year, Width=>4);
 21    Text_IO.New_Line;
 22 end Today;