GetDayOfMonthByDateTime

Returns the day of month from an FTODate object.

Syntax

GetDayOfMonthByDateTime(ftoDate: FTODate): number

Parameters

  • ftoDate: FTODate - The FTODate object to extract the day from

Return Value

Returns a number representing the day of month (1-31).

Description

The GetDayOfMonthByDateTime method extracts the day of month from an FTODate object. The returned value is between 1 and 31, depending on the month.

Example

// Create FTODate object
const currentDate = this.api.TimeCurrent();
const day = this.api.GetDayOfMonthByDateTime(currentDate);
console.log(`Day of month: ${day}`);

// Format with leading zero
const formattedDay = day.toString().padStart(2, "0");
console.log(`Formatted day: ${formattedDay}`);

// Check for month end
const month = currentDate.monthOf();
const year = currentDate.yearOf();
const lastDayOfMonth = new Date(year, month, 0).getDate();
const isMonthEnd = day === lastDayOfMonth;
console.log(`Is month end: ${isMonthEnd}`);

// Format full date
console.log(`Date: ${year}.${month}.${formattedDay}`);

Last updated