DateTime, the Epoch and DocumentDb

后端 未结 3 922
时光说笑
时光说笑 2020-12-19 10:56

So I read this very interesting blog on working with datetime in Azure DocumentDb. The problem being that, right now, Azure DocumentDb does not support range search on datet

3条回答
  •  旧巷少年郎
    2020-12-19 11:35

    The answer by Teo is correct, except that I suspect in terms of being "well established", the billions of Microsoft Excel, LibreOffice, and Lotus 1-2-3 spreadsheets with their own epoch may far outnumber Unix Time usage. Or the billion of Apple Cocoa devices and computers with their own epoch.

    Be aware that a couple dozen different epochs have been used by various computer environments. Unix time is far from being alone or even dominant.

    Also be aware that there is no such thing as Unix time exactly. Variations include using whole seconds, milliseconds, microseconds, or nanoseconds.

    When possible, use a date-time savvy data type. Be sure to study the doc and experiment to understand clearly it's behavior.

    Where not possible to use a data type, fallback to using a string in the various ISO 8601 formats. Some of those standard formats are alphabetically chronological in sorting, especially for date-only values: YYYY-MM-DD.

    Leap seconds are ignored in every date-time tracking system I know of. Their purpose is to make our hourly clock jive with calendar, so for business purposes the Leap Second is in a sense meant to be ignored.

    Date-time work is surprisingly tricky and slippery business. Search StackOverflow to discover the many issues. Try to avoid rolling your own solutions. For C# in particular, look at the Noda Time library.

提交回复
热议问题