{"id":2495,"date":"2024-04-01T11:21:10","date_gmt":"2024-04-01T03:21:10","guid":{"rendered":"http:\/\/www.plm.cn\/?p=2495"},"modified":"2024-04-01T11:21:10","modified_gmt":"2024-04-01T03:21:10","slug":"%e5%90%84%e7%a7%8d%e7%a8%8b%e5%ba%8f%e5%a4%84%e7%90%86unix%e6%97%b6%e9%97%b4%e6%88%b3%ef%bc%88unix-timestamp%ef%bc%89%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"http:\/\/www.plm.cn\/2495\/","title":{"rendered":"\u5404\u79cd\u7a0b\u5e8f\u5904\u7406Unix\u65f6\u95f4\u6233\uff08Unix timestamp\uff09\u65b9\u6cd5"},"content":{"rendered":"
Java<\/td>\n | time<\/td>\n<\/tr>\n | ||||||||||||||||||||||
JavaScript<\/td>\n | Math.round(new Date().getTime()\/1000)<\/td>\n<\/tr>\n | ||||||||||||||||||||||
getTime()\u8fd4\u56de\u6570\u503c\u7684\u5355\u4f4d\u662f\u6beb\u79d2<\/td>\n<\/tr>\n | |||||||||||||||||||||||
Unix \/ Linux<\/td>\n | date +%s<\/td>\n<\/tr>\n | ||||||||||||||||||||||
Microsoft .NET \/ C#<\/td>\n | epoch = (DateTime.Now.ToUniversalTime().Ticks – 621355968000000000) \/ 10000000<\/td>\n<\/tr>\n | ||||||||||||||||||||||
Python<\/td>\n | 1\uff09 import time\u00a0 \u00a0 2\uff09 time.time()<\/td>\n<\/tr>\n | ||||||||||||||||||||||
Perl<\/td>\n | time<\/td>\n<\/tr>\n | ||||||||||||||||||||||
PHP<\/td>\n | time()<\/td>\n<\/tr>\n | ||||||||||||||||||||||
MySQL<\/td>\n | SELECT unix_timestamp(now())<\/td>\n<\/tr>\n | ||||||||||||||||||||||
PostgreSQL<\/td>\n | SELECT extract(epoch FROM now())<\/td>\n<\/tr>\n | ||||||||||||||||||||||
SQL Server<\/td>\n | SELECT DATEDIFF(s, ‘1970-01-01 00:00:00’, GETUTCDATE())<\/td>\n<\/tr>\n | ||||||||||||||||||||||
Ruby<\/td>\n | \u83b7\u53d6 Unix\u65f6\u95f4\u6233\uff1aTime.now\u00a0 \u00a0 or\u00a0 \u00a0Time.new<\/td>\n<\/tr>\n | ||||||||||||||||||||||
\u663e\u793a Unix\u65f6\u95f4\u6233\uff1aTime.now.to_i<\/td>\n<\/tr>\n | |||||||||||||||||||||||
VBScript \/ ASP<\/td>\n | DateDiff(“s”, “01\/01\/1970 00:00:00”, Now())<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n <\/p>\n \u7f16\u7a0b\u7a0b\u5e8f\u8d4b\u503c\u65f6\u95f4\u53d8\u91cf\u4e3aUnix\u65f6\u95f4\u6233\uff08Unix timestamp\uff09\u65b9\u6cd5<\/h3>\n
|