The Unix epoch (or Unix time or POSIX time or Unix timestamp) is the number of seconds that have elapsed since January 1, 1970 (midnight UTC/GMT), not counting leap seconds (in ISO 8601: 1970-01-01T00:00:00Z). Literally speaking the epoch is Unix time 0 (midnight 1/1/1970), but 'epoch' is often used as a synonym for 'Unix time'. Many Unix systems store epoch dates as a signed 32-bit integer, which might cause problems on January 19, 2038 (known as the Year 2038 problem or Y2038).
source http://www.epochconverter.com/
source http://www.epochconverter.com/
JavaScript:
//PHP
time()
//Python
import time first, then time.time()
//Ruby
Time.now (or Time.new). To display the epoch: Time.now.to_i
//Perl
time *or when cmd line* perl -e "print time"
//Java
long epoch = System.currentTimeMillis()/1000;
//C#
var epoch = (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
//Objective-C
[[NSDate date] timeIntervalSince1970]; (returns double) or NSString *currentTimestamp = [NSString stringWithFormat:@"%f", [[NSDate date] timeIntervalSince1970]];
//C++11
double now = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count();
//VBScript/ASP
DateDiff("s", "01/01/1970 00:00:00", Now())
//AutoIT
_DateDiff('s', "1970/01/01 00:00:00", _NowCalc())
//Delphi (Tested in Delphi 2010)
Epoch := DateTimetoUnix(Now);
//R
as.numeric(Sys.time())
//Erlang
calendar:datetime_to_gregorian_seconds(calendar:universal_time())-719528*24*3600.
//MySQL
SELECT unix_timestamp(now())
//PostgreSQL
SELECT extract(epoch FROM now());
//SQLite
SELECT strftime('%s', 'now');
//Oracle PL/SQL (still using oracle?)
SELECT (SYSDATE - TO_DATE('01/01/1970 00:00:00', 'MM-DD-YYYY HH24:MI:SS')) * 24 * 60 * 60 FROM DUAL
//SQL Server
SELECT DATEDIFF(s, '1970-01-01 00:00:00', GETUTCDATE())
//JavaScript (getTime() returns time in milliseconds.)
Math.round(new Date().getTime()/1000.0)
//Visual FoxPro (Warning: time zones not handled correctly)
DATETIME() - {^1970/01/01 00:00:00}
//Adobe ColdFusion
<cfset epochTime = left(getTickcount(), 10)>
//Tcl/Tk
clock seconds
//Unix/Linux Shell
date +%s
//PowerShell
get-date (get-date).touniversaltime() -uformat "%s"