help files
Z505 | PasWiki | FUQ | Search | Main Docs | API Guide



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

TryEncodeDateMonthWeek

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

Declaration

Source position: dateutil.inc line 329

function TryEncodeDateMonthWeek(

  const AYear: Word;

  const AMonth: Word;

  const AWeekOfMonth: Word;

  const ADayOfWeek: Word;

  var AValue: TDateTime

):Boolean;

Arguments

AYear

  

Year

AMonth

  

Month in the year

AWeekOfMonth

  

Week in the month

ADayOfWeek

  

Day in the week

AValue

  

Encoded TDateTime value

Function result

True if the encoding was succesful, False if not.

Description

TryEncodeDateTime encodes the values AYearAMonth, WeekOfMonth,ADayOfWeek, to a date value and returns this value in AValue.

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

See also

DecodeDateMonthWeek

  

Decode a DateTime value in a month, week of month and day of week

EncodeDateTime

  

Encodes a DateTime value from all its parts

EncodeDateWeek

  

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

EncodeDateDay

  

Encodes a year and day of year to a DateTime value

EncodeDateMonthWeek

  

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

TryEncodeDateTime

  

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

TryEncodeDateWeek

  

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

TryEncodeDateDay

  

Encode a year and day of year to a TDateTime value

NthDayOfWeek

  

Calculate which occurrence of weekday in the month a given day represents

Example

Program Example86;

{ This program demonstrates the TryEncodeDateMonthWeek function }

Uses SysUtils,DateUtils;

Var
  Y,M,Wom,Dow : Word;
  TS : TDateTime;

Begin
  DecodeDateMonthWeek(Now,Y,M,WoM,DoW);
  If TryEncodeDateMonthWeek(Y,M,WoM,Dow,TS) then
    Writeln('Today is : ',DateToStr(TS))
  else
    Writeln('Invalid year/month/week/dow indication');
End.

Notes

 No notes exist for this page yet. 





lufdoc, Powtils, fpc, freepascal, delphi, kylix, c/c++, mysql, cgi web framework docs, Z505