Java
String date = new java.text.SimpleDateFormat("MM/dd/yyyy HH:mm:ss").format(new java.util.Date (epoch*1000))
PHP
echo date(output format, epoch)
Python
import time
timeStamp = 1557502800
timeArray = time.localtime(timeStamp)
otherStyleTime = time.strftime("%Y-%m-%d %H:%M:%S", timeArray)
PowerShell
Function get-epochDate ($epochDate) {
[timezone]::CurrentTimeZone.ToLocalTime(([datetime]'1/1/1970').AddSeconds($epochDate))
}
SQL Server
DATEADD(s, epoch, '1970-01-01 00:00:00')
C#
private string epoch2string(int epoch) {
return new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(epoch).ToShortDateString();
}
Objective-C
NSDate * myDate = [NSDate dateWithTimeIntervalSince1970:epoch]; NSLog(@"%@", date)
Lua
datestring = os.date([format[,epoch]])
AutoIT
_DateAdd("s", $EpochSeconds , "1970/01/01 00:00:00")
Delphi
myString := DateTimeToStr(UnixToDateTime(Epoch))
R
as.POSIXct(epoch, origin="1970-01-01", tz="GMT")
PostgreSQL
versions 8.1+: SELECT to_timestamp(epoch)
versions older: SELECT TIMESTAMP WITH TIME ZONE 'epoch' + epoch * INTERVAL '1 second'
SQLite
SELECT datetime(epoch_to_convert, 'unixepoch')
local timezone: SELECT datetime(epoch_to_convert, 'unixepoch', 'localtime')
Oracle PL/SQL
SELECT to_date('01-JAN-1970','dd-mon-yyyy')+(1526357743/60/60/24) from dual
Replace 1526357743 with epoch
IBM Informix
SELECT dbinfo('utc_to_datetime',epoch) FROM sysmaster:sysdual;
Adobe ColdFusion
DateAdd("s",epoch,"1/1/1970");
Tcl/Tk
clock format 1325376000 Documentation
Unix/Linux Shell
date -d @1520000000