Language | |
C++ | std::chrono::duration_cast<std::chrono::milliseconds> (std::chrono::system_clock::now().time_since_epoch()).count() |
C# | DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() DateTime.UtcNow.Ticks / TimeSpan.TicksPerMillisecond; |
Dart | DateTime.now().millisecondsSinceEpoch |
Go / Golang | time.Now().UnixNano() / 1000000 |
Java / Groovy / Kotlin | System.currentTimeMillis() |
Javascript | Date.now() // or: new Date().getTime() |
MySQL | UNIX_TIMESTAMP() * 1000 |
Objective-C | (long long)([[NSDate date] timeIntervalSince1970] * 1000.0) |
Oracle PL/SQL | SELECT (SYSDATE-CAST(TO_TIMESTAMP_TZ('01-01-1970 00:00:00+00:00', 'DD-MM-YYYY HH24:MI:SS TZH:TZM') as date)) * 24 * 60 * 60 * 1000 FROM DUAL |
Perl | use Time::HiRes qw(gettimeofday); print gettimeofday; |
PHP | round(microtime(true) * 1000) |
PowerShell | [DateTimeOffset]::UtcNow.ToUnixTimeMilliseconds() |
Python | int(round(time.time() * 1000)) |
R | as.numeric(Sys.time()) * 1000 |
Ruby | (Time.now.to_f * 1000).floor |
Rust | std::time::SystemTime::now().duration_since(UNIX_EPOCH).expect("error") |
Scala | val timestamp: Long = System.currentTimeMillis |
SQL Server | DATEDIFF(ms, '1970-01-01 00:00:00', GETUTCDATE()) |
SQLite | STRFTIME('%s', 'now') * 1000 |
Swift | let currentTime = NSDate().timeIntervalSince1970 * 1000 |
'Java' 카테고리의 다른 글
[Java] Integer → int 캐스팅하기(Integer to int) (0) | 2023.01.11 |
---|---|
[Java] for문 vs 향상된(개선된) for문 (0) | 2022.12.30 |
[Java] Array / List / ArrayList 차이점 (3) | 2022.12.13 |
[IntelliJ] 인텔리제이 주석 안됨 현상 해결 방법!("/", "¿") (0) | 2022.09.13 |
[Java] StringUtils.hasText, isEmpty, isBlank 비교하기 (0) | 2022.08.05 |