将日期时间刻度从 C# 移植到 Python
我有一行C#代码
string.Format("{0:D19}", DateTime.MaxValue.Ticks - DateTime.UtcNow.Ticks)
,我正在尝试将其移植到Python。 我无法理解如何移植两个方面:
我找不到 DateTime.MaxValue.Ticks
和 DateTime.UtcNow.Ticks
的等效 Python 表示形式。我可以获得 unix 时间戳,但据我了解,这与 C# Ticks
对象不同。
有人可以将上述 C# 代码移植到 Python 吗?
I have a a C# line of code
string.Format("{0:D19}", DateTime.MaxValue.Ticks - DateTime.UtcNow.Ticks)
That I am trying to port over to Python.
I'm having trouble understanding how to port two aspects:
I can't find an equivalent Python representation of DateTime.MaxValue.Ticks
and DateTime.UtcNow.Ticks
. I can get to a unix timestamp, but to my understanding, that is differnet than the C# Ticks
object.
Does anyone have any pointers to porting the above C# code to Python?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在 Azure 表存储中的数据遵循 Log-Tail 模式(与您的代码相同),并且正在寻找一种方法来过滤 RowKey,以获得比过滤 Timestamp 更好的查询性能,并发现这对我有用:
改编自
C# 的 system.datetime.Ticks() 的 python 等价物是什么?
以及上面@Johnny Mopp 的评论
I have data in Azure Table Storage that follows the Log-Tail pattern (which is identical to your code) and was looking for a way to filter on RowKey for better query performance than filtering on Timestamp and found that this worked for me:
Adapted from
What is python equivalent of C#'s system.datetime.Ticks()?
and comment from @Johnny Mopp above