I’m using Gnat (old compiler of ada95) and I’m having problem to print the date.
I declared : (with Ada.calendar)
Cdate: Calendar.Time;
Cdate := Calendar.Time_Of(Year => 2010, Month => 1, Day => 10);
Now I’ve tried to print it –
Put_Line("Year : " & Year(Cdate)'Img);
But I didn’t managed to do so…
You only provided program fragments, so it’s hard to tell what you actually wrote and are trying to run. And you didn’t indicate “how” it didn’t work. Did it not compile? Did it compile but not run correctly?
If the fragments were cut as-is from your code and pasted here, you’ve probably gotten syntax errors.
Here’s a fully working program that does what you appear to want:
This was compiled and run using Gnat, and while you may be using an old version of it, it is not itself an “old compiler”, the latest/greatest free version of it, GNAT GPL 2009, is readily available.