DateTime.Now and Culture/Timezone specific

后端 未结 5 1642
你的背包
你的背包 2020-12-07 17:00

Our application was designed to handle user from different Geographic location.

We are unable to detect what is the current end user local time and

5条回答
  •  甜味超标
    2020-12-07 17:22

    If you want to show consistent date/time history to the user, regardless of the locale they are viewing the history from, then:

    1. During Save, store not only UTC "creation" date/time, but also the detected locale
    2. Use stored saved from locale to compute original date/time and emit a string to display (i.e. do not use current user locale when you're diplaying it)

    If you don't have the ability to amend your storage, then perhaps you can change your submit to send the "current client time", store it literally (do not convert to UTC) and then display literally (do not convert to detected culture)

    But as I say in my comment under your question, I am not certain I got your requirements right.

提交回复
热议问题