Skip to main content

MinuteOfTheYear

Function MinuteOfTheYear(const AValue: TDateTime): LongWord

Example

procedure ScriptEvent(var Value: variant);
var
InputValue: TDateTime;
begin
InputValue := EncodeDateTime(2026, 1, 2, 1, 2, 30, 0);
Value := MinuteOfTheYear(InputValue); // 1502
end;

Usage

MinuteOfTheYear returns the zero-based minute index within the encoded calendar year.

Parameters

NameTypeDescription
AValueTDateTime, constEncoded date/time whose whole-minute position within its calendar year is required.

Returns

A LongWord from 0 through 525,599 in a common year or through 527,039 in a leap year.

Behaviour

  • The index begins at zero on 1 January at midnight and resets at the next calendar year.
  • Gregorian leap-year rules determine the maximum.
  • Seconds and milliseconds do not contribute and are not rounded.
  • Calendar year, not ISO week-year, determines the boundary.

Important usage notes

  • The Velox uses Cardinal, equivalent to the exposed unsigned 32-bit LongWord.
  • This is an encoded field index rather than a timezone-aware duration since the real start of the year.
  • Invalid or non-finite input can raise during decoding.

Usage notes

Use a wider or explicitly unsigned destination if later script arithmetic could otherwise coerce this LongWord unexpectedly.

Additional Technical Info

MinuteOfTheYear returns the zero-based whole-minute position within the encoded calendar year, measured from 1 January at midnight.

The example is fictional, deterministic and source-reviewed. It was not executed by the documentation workflow.

Implementation

The DateUtils import binds directly to Delphi 37.0 System.DateUtils.MinuteOfTheYear. It calculates the hour position from the zero-based calendar day ordinal, multiplies by 60 and adds the minute-within-hour component.

Side effects

None.

Errors

Decode exceptions propagate unchanged from Delphi.

Performance and concurrency

Constant-time field extraction and integer arithmetic with no external I/O or shared mutable state.

Related entries

External references

Created 2026-07-15