TimeCurrent
Syntax
TimeCurrent(): FTODateReturn Value
Description
Example
// Get current time
const currentTime = this.api.TimeCurrent();
// Display current time components
console.log(
`Date: ${currentTime.yearOf()}.${currentTime.monthOf()}.${currentTime.dayOfMonth()}`
);
console.log(
`Time: ${currentTime.hour()}:${currentTime.minute()}:${currentTime.second()}`
);
// Get timestamp in milliseconds
const timestamp = currentTime.getTime();
console.log(`Timestamp: ${timestamp}`);
// Format the date
console.log(`Formatted date: ${currentTime.toString()}`);
// Check if it's weekend
const dayOfWeek = currentTime.dayOfWeek();
const isWeekend = dayOfWeek === 0 || dayOfWeek === 6;
console.log(`Is weekend: ${isWeekend}`);Last updated