将数据转换为数值类型格式

发布于 2025-02-13 23:25:08 字数 298 浏览 3 评论 0原文

有人可以帮助确定此日期和时间的格式(时间戳)。我目前正在尝试具有链接的Webhook具有我需要获得时间戳的安全要求。但是,时间戳的格式对我来说是新的。请参阅下面的格式:

格式化的时间戳转换为字符串应该看起来像:

1496734173

我不知道如何将日期和时间转换为类似的东西。我不知道该代码是什么或实际说的时间是什么。

单击此处以获取格式

Can somebody help identify the format of this date and time (timestamp). THe webhook I am currently trying to have a link to has a security requirements where I need to get the timestamp. However, the format of the timestamp is new to me. See below the format:

The formatted timestamp converted to string should look like this:

1496734173

I have no idea how do I convert a date and time into something like this. I don't know what this code is or what time does it actually tells.

Click Here for the format

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

悲念泪 2025-02-20 23:25:08

看起来像是一个非常标准的Unix时期时间戳。假设我们使用UTC(GMT)时区,日期是2017年6月6日,星期二7:29:33 AM。

UNIX时间是自1970年1月1日以来过去的秒数。时间戳意味着1496734173秒以来已经过去了,大约是47岁半,即2017年6月6日。

您可以转换dateTime < /code>以以下方式对将UNIX时间戳的对象:

DateTime dateTime = DateTime.Now; // this would be your DateTime
DateTimeOffset offset = new DateTimeOffset(dateTime);
long epoch = offset.ToUnixTimeSeconds(); // our epoch is a 64 bit integer, i.e. long

或者,一行:

long epoch = new DateTimeOffset(dateTime).ToUnixTimeSeconds();

That looks like a pretty standard UNIX epoch timestamp. Assuming we're using the UTC (GMT) timezone, the date is Tuesday, June 6, 2017 7:29:33 AM.

UNIX time is the amount of seconds that have passed since Jan 1, 1970. The timestamp means 1496734173 seconds have passed since then, which is about 47 and a half years, i.e. June 6, 2017.

You can convert a DateTime object to a UNIX timestamp in the following way:

DateTime dateTime = DateTime.Now; // this would be your DateTime
DateTimeOffset offset = new DateTimeOffset(dateTime);
long epoch = offset.ToUnixTimeSeconds(); // our epoch is a 64 bit integer, i.e. long

Or, in one line:

long epoch = new DateTimeOffset(dateTime).ToUnixTimeSeconds();
鲜血染红嫁衣 2025-02-20 23:25:08

我认为这代表 unix timestamp。

UNIX时间戳记是一种将时间作为运行总数秒的方式。这项计数从1970年1月1日在UTC的Unix时期开始。

在这里,您可以尝试在此处转换您的时间戳:检查您的时间

I think that this represents the UNIX timestamp.

The unix time stamp is a way to track time as a running total of seconds. This count starts at the Unix Epoch on January 1st, 1970 at UTC.

Here you can try and convert your timestamp here: check your time

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文