在线时间戳(Unix TimeStamp)转换器

105 天前
 A2zygote

什么是时间戳?

时间戳是一串字符或编码信息,用于表示特定的日期和时间,通常在计算机中用于记录事件发生的时间。它通常表示自 Unix 纪元( 1970 年 1 月 1 日 00:00:00 UTC )以来的秒数或毫秒数。时间戳广泛应用于数据库、日志系统和应用程序中,以跟踪事件、同步数据或管理时间敏感的操作。

获取当前时间戳

Swift

NSDate().timeIntervalSince1970

Go

import (
  "time"
)
int64(time.Now().Unix())

Java

System.currentTimeMillis() / 1000

C

#include <sys/time.h>

// ...
struct timeval tv;
gettimeofday(&tv, NULL);
// 秒:tv.tv_sec
// 毫秒:tv.tv_sec * 1000LL + tv.tv_usec / 1000

JavaScript

Math.round(new Date() / 1000)

Objective-C

[[NSDate date] timeIntervalSince1970]

PHP

<?php
// pure php
time();

Python

import time
time.time()

更多语言获取当前时间戳方式,请移步 https://www.timestamps.top

在线时间戳(Unix TimeStamp)转换器

https://www.timestamps.top 免费在线时间戳转换工具!快速将日期时间转换为 Unix 时间戳或时间戳转日期时间,支持多格式,简单易用!

同时提供了Discord timestamp.

2261 次点击
所在节点    分享创造
6 条回复
Phant0m
105 天前
```
date +%s

date -d @1747929000

```
Tumblr
105 天前
```powershell
#get Unix time stamp
Get-Date -uf %s
#get time from unix time stamp $uts
[datetime]::UnixEpoch.AddSeconds($uts)
```
ginakira
105 天前
希望能支持纳秒
lzyuan1006
104 天前
既然代码都贴出来了,是不是可以考虑做一些时间格式转换之类的功能啊
miwang
84 天前
楼主分享的网站确实不错,我是一直用这个也还可以 https://timestamp.onl
0donghui0
41 天前
自己做的小工具: https://www.tsconv.com/

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/1133658

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX