TimeDay
Syntax
TimeDay(unixTimeSeconds: number): numberParameters
Return Value
Description
Example
// Get day from timestamp
const timestamp = 1707739200; // 2024.02.12 12:00:00 UTC
const day = this.api.TimeDay(timestamp);
console.log(`Day: ${day}`);
// Format with leading zero
const formattedDay = day.toString().padStart(2, "0");
console.log(`Formatted day: ${formattedDay}`);
// Check for month end
const month = this.api.TimeMonth(timestamp);
const year = this.api.TimeYear(timestamp);
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