Simple date and timestamp converter. Support the conversion of human date and Unix epoch/timestamp. Provide developers how to get timestamp in multiple programming languages.

Timestamp Converter

How to get unix epoch/timestamp in multiple programming language
Language Get timestamp
Java time
PHP time()
JavaScript Math.round(new Date().getTime()/1000)
MySQL SELECT unix_timestamp(now())
PostgreSQL SELECT extract(epoch FROM now())
SQLite SELECT strftime('%s', 'now');
SQL Server SELECT DATEDIFF(s, '1970-01-01 00:00:00', GETUTCDATE())
Python first import time, then time.time()
Microsoft .NET / C# epoch = (DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000
Golang time.Now().Unix()
Perl time
Ruby or
Lua epoch = os.time([date])
R as.numeric(Sys.time())
PowerShell [int][double]::Parse((Get-Date (get-date).touniversaltime() -UFormat %s))
Unix / Linux date +%s
VBScript / ASP DateDiff("s", "01/01/1970 00:00:00", Now())
C / C++ time(NULL)
Objective-C [[NSDate date] timeIntervalSince1970]
Swift now.timeIntervalSince1970
Delphi DateTimeToUnix(Now)
Tips: What is Unix timestamp: Unix timestamp, or Unix time, or Unix Epoch, POSIX time, is a time representation defined as Greenwich Mean 1970 The total number of seconds from 00:00:00 on January 01 to the present. Unix timestamps are not only used in Unix systems, Unix-like systems, but also in many other operating systems. The 0 of the UNIX timestamp is in accordance with the ISO 8601 specification: 1970-01-01T00:00:00Z. One hour is expressed as a UNIX timestamp format of: 3600 seconds; one day is represented as a UNIX timestamp of 86400 seconds, and leap seconds are not counted. UNIX timestamps are stored as 32 bits on most UNIX systems, which can cause a 2038 problem or Y2038.
Share this page

Copyright © 2018 - 2024 ToolPie. All rights reserved