Swift |
NSDate().timeIntervalSince1970
|
Go |
import (
"time"
)
time.Now().Unix()
|
Java |
(int) (System.currentTimeMillis() / 1000)
|
JavaScript |
Math.round(new Date() / 1000)
|
Objective-C |
[[NSDate date] timeIntervalSince1970]
|
MySQL |
SELECT unix_timestamp(now())
|
PHP |
time()
|
Python |
import time
time.time()
|
Shell |
date +%s
|
Lua |
os.time()
|
C# |
(DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000
|
C |
#include "time.h"
void main ()
{
time_t rawtime;
struct tm * timeinfo;
time ( &rawtime );
timeinfo = localtime ( &rawtime );
printf ( "/007The current date/time is: %s", asctime (timeinfo) );
exit(0);
}
|