// Retorna o timestamp em milissegundos
const timestamp = Date.now();
import time
# time.time() retorna segundos (float)
# Multiplicamos por 1000 e convertemos para int
timestamp = int(time.time() * 1000)
// Retorna milissegundos (long)
long timestamp = System.currentTimeMillis();
// Java 8+ (Instant)
// long timestamp = Instant.now().toEpochMilli();
// Forma moderna e preferida (retorna long)
long timestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
package main
import (
"fmt"
"time"
)
func main() {
// Go 1.17+
timestamp := time.Now().UnixMilli()
fmt.Println(timestamp)
}
# Time.now.to_f retorna segundos (float)
# Multiplicamos por 1000 e convertemos para int
timestamp = (Time.now.to_f * 1000).to_i