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

TryEncodeDateDay

Encode a year and day of year to a TDateTime value

Declaration

Source position: dateutil.inc line 322

function TryEncodeDateDay(

  const AYear: Word;

  const ADayOfYear: Word;

  out AValue: TDateTime

):Boolean;

Arguments

AYear

  

Year

ADayOfYear

  

Day in the year

AValue

  

Encoded TDateTime value.

Function result

True if the encoding was succesful, False if not.

Description

TryEncodeDateDay encodes the values AYear and ADayOfYear to a date value and returns this value in AValue.

If the encoding was succcesful, True is returned. False is returned if any of the arguments is not valid.

See also

EncodeDateDay

  

Encodes a year and day of year to a DateTime value

EncodeDateTime

  

Encodes a DateTime value from all its parts

EncodeDateMonthWeek

  

Encodes a year, month, week of month and day of week to a DateTime value

EncodeDateWeek

  

Encode a TDateTime value from a year, week and day of week triplet

TryEncodeDateTime

  

Encode a Year, Month, Day, Hour, minute, seconds, milliseconds tuplet to a TDateTime value

TryEncodeDateMonthWeek

  

Encode a year, month, week of month and day of week to a TDateTime value

TryEncodeDateWeek

  

Encode a year, week and day of week triplet to a TDateTime value

Example

Program Example84;

{ This program demonstrates the TryEncodeDateDay function }

Uses SysUtils,DateUtils;

Var
  Y,DoY : Word;
  TS : TDateTime;

Begin
  DecodeDateDay(Now,Y,DoY);
  If TryEncodeDateDay(Y,DoY,TS) then
    Writeln('Today is : ',DateToStr(TS))
  else
    Writeln('Wrong year/day of year indication');
End.
The latest version of this document can be found at lazarus-ccr.sourceforge.net.