We have moved to www.dataGenX.net, Keep Learning with us.

Wednesday, July 08, 2015

What is EPOCH ?

EPOCH is time in seconds since 00:00:00 Coordinated Universal Time (UTC), Thursday, 1 January 1970 ( 1970/01/01 00:00:00 UTC). Or the epoch is Unix time 0 (midnight 1/1/1970), but 'epoch' is often used as a synonym for 'Unix time'. EPOCH time is widely used in every field of IT sector (specially in unix like OS ) where we have to keep difference is generation of something based on time.

These are the way to convert current time to EPOCH in different DBs or Languages -

Python import time first, then time.time()
Java long epoch = System.currentTimeMillis()/1000;
C# var epoch = (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
Oracle PL/SQL 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())
Unix/Linux Shell date +%s

Like the Facebook Page & join Group

For WHATSAPP group , drop a msg to 91-88-00-906098

No comments :

Post a Comment