获取当前时间戳
Swift
NSDate().timeIntervalSince1970
            
Go
import (
"time"
)
int32(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);
}
                    
4条评论
21212
2021-11-03 18:46:02
@vaga:121
21212
2021-11-03 18:45:47
不错吧
vaga
2021-08-16 10:39:32
毫秒,可用
喜欢臭美的欧尼
2021-05-01 16:26:40
1212121