sajad torkamani
function dateToUnixTimestamp(date: Date): number {
  return Math.floor(date.getTime() / 1000);
}

// Example usage
const myDate = new Date(); // Create a Date instance for the current time
const unixTimestamp = dateToUnixTimestamp(myDate);

console.log(unixTimestamp); // Outputs the UNIX timestamp for `myDate`

Leave a comment

Your email address will not be published. Required fields are marked *