JCL Help:ISOWeekNumber@TDateTime

From Project JEDI Wiki
Jump to navigationJump to search


Summary

Returns the week number of a given date. Optionally the reference-year for this week and the weekday can be requested


Pascal

 function ISOWeekNumber(DateTime: TDateTime; out YearOfWeekNumber: Integer; out WeekDay: Integer): Integer; overload;
function ISOWeekNumber(DateTime: TDateTime; out YearOfWeekNumber: Integer): Integer; overload;
function ISOWeekNumber(DateTime: TDateTime): Integer; overload;


Parameters

Parameters Description
DateTime: TDateTime The DateTime for which to retrieve the year and week number.
out YearOfWeekNumber: Integer (Optional) The year the returned week belongs to.
out WeekDay: Integer (Optional) The day in this week.


Return Value

The function returns the week number of the specified DateTime. The year this week belongs to and the day in this week are returned through the var parameters.


Description

ISOWeekNumber returns week number of the specified date according to the ISO 8601 specification. Optionally the reference-year for this week and the weekday can be requested. In ISO 8601 weeks start with Monday and the first week of a year is the one which includes the first Thursday. The function returns the week number as the function result and the year through the var parameter.


See Also

ISOWeekToDateTime


About

Unit

JclDateTime


Donator

Anonymous


Notes

The specified DateTime is assumed to be after 1/1/0001 and before 1/1/10000). According to ISO 8601 the reference year for the week can be the same as in DateTime, the previous or the next year. The constants ISOFirstWeekDay=2 and ISOFirstWeekMinDays=4 are defined for ISO compatibility. Other values might be useful in some instances and can be set in the source code.


Contribute to this help topic

This documentation wiki is based on the collaborative effort of Project JEDI users. Your edits are welcome in order to improve documentation quality: edit this page