with Ada.Calendar; with Ada.Text_IO; procedure Unix_Timestamp_To_Date is -- The Unix epoch starts on January 1, 1970 Epoch : constant Ada.Calendar.Time := Ada.Calendar.Time_Of(1970, 1, 1); -- Example Unix timestamp (1692902400 corresponds to August 24, 2023) Unix_Timestamp : constant Integer := 1692902400; -- Convert Unix timestamp to Ada.Calendar.Time Specific_Time : Ada.Calendar.Time := Epoch + Ada.Calendar.Duration(Unix_Timestamp); begin -- Output the converted date and time Ada.Text_IO.Put_Line(Ada.Calendar.Image(Specific_Time)); end Unix_Timestamp_To_Date;
Ada.Calendar
Ada.Text_IO
Unix_Timestamp
Ada.Calendar.Time
Ada.Text_IO.Put_Line
Ada.Calendar.Image(Timestamp)
Clock
Year (Time)
Time
Year(Clock)
Month (Time)
Month(Clock)
Day (Time)
Day(Clock)
Second (Time)
Second(Clock)
Split (Time, Year, Month, Day, Seconds)
Split(Clock, Y, M, D, S)
Time_Of (Year, Month, Day, Seconds)
Time_Of(2023, 8, 28, 12)
Time_Zones
Ada.Calendar.Time_Zones