TimeMonth
Syntax
TimeMonth(unixTimeSeconds: number): numberParameters
Return Value
Description
Example
// Get month from timestamp
const timestamp = 1707739200; // 2024.02.12 12:00:00 UTC
const month = this.api.TimeMonth(timestamp);
console.log(`Month: ${month}`);
// Format with leading zero
const formattedMonth = month.toString().padStart(2, "0");
console.log(`Formatted month: ${formattedMonth}`);
// Get month name
const monthNames = [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December",
];
console.log(`Month name: ${monthNames[month - 1]}`);
// Check for quarter end
const isQuarterEnd = month % 3 === 0;
console.log(`Is quarter end: ${isQuarterEnd}`);Last updated