Minute

Returns the current minute.

Syntax

Minute(): number

Return Value

Returns a number representing the current minute (0-59).

Description

The Minute method returns the minute component of the current time. The returned value is between 0 and 59.

Example

// Get current minute
const minute = this.api.Minute()
console.log(`Current minute: ${minute}`)

// Format minute with leading zero
const formattedMinute = minute.toString().padStart(2, '0')
console.log(`Formatted minute: ${formattedMinute}`)

// Check for specific market events (example: market opening at 9:30)
const hour = this.api.Hour()
const isMarketOpening = hour === 9 && minute === 30
if (isMarketOpening) {
    console.log('Market is opening')
}

// Calculate minutes until next hour
const minutesUntilNextHour = 60 - minute
console.log(`Minutes until next hour: ${minutesUntilNextHour}`)

// Check for time intervals
const isQuarterHour = minute % 15 === 0
if (isQuarterHour) {
    console.log('Quarter hour mark')
}

Last updated