[Overview][Constants][Types][Procedures and functions][Variables][Index] Reference for unit 'Dos' (#rtl)

GetDate

Get the current date

Declaration

Source position: dosh.inc line 95

procedure GetDate(

  var year: Word;

  var month: Word;

  var mday: Word;

  var wday: Word

);

Description

GetDate returns the system's date. Year is a number in the range 1980..2099.mday is the day of the month, wday is the day of the week, starting with Sunday as day 0.

Errors

None.

See also

GetTime

  

Return the current time

SetDate

  

Set system date

Example

Program Example2;
uses Dos;

{ Program to demonstrate the GetDate function. }

const
  DayStr:array[0..6] of string[3]=('Sun','Mon','Tue','Wed','Thu','Fri','Sat');
  MonthStr:array[1..12] of string[3]=('Jan','Feb','Mar','Apr','May','Jun',
                                      'Jul','Aug','Sep','Oct','Nov','Dec');
var
  Year,Month,Day,WDay : word;
begin
  GetDate(Year,Month,Day,WDay);
  WriteLn('Current date');
  WriteLn(DayStr[WDay],', ',Day,' ',MonthStr[Month],' ',Year,'.');
end.
The latest version of this document can be found at lazarus-ccr.sourceforge.net.