UTC时间应用程序相关的问题,(C#,ASP.NET和放大器; SQL) [英] UTC Time related issue in Application, (C#,ASP.NET & SQL)
问题描述
我开发与销售及放一个应用程序;购买报告。
在我通过使用购买和放大器的数据生成的图表;销售报告。
I am developing one application related to Sales & Purchase reports. In that I am generating chart by using the data of that purchase & sales report.
采购订单和放大器的创造;销售订单日期是关于(UTC + 5.30)的时间,即此时是印度孟买。
The creation of purchase order & sales order date is with respect to the (UTC + 5.30) time i.e. this time is for Mumbai,India.
情景-1
假设这是该方案(目前此应用程序是在印度用于此方案)
Suppose this is the scenario (currently This application is used in India For This scenario)
Lets Say,
**Purchase Order & sales Order Generation is as follows**
Purchase Order(Rs) Sales Order(Rs)
31-Jan-2014 11.00PM 1000 2000
31-Jan-2014 10.00PM 2000 4000
根据这一点,如果我创建的图表,然后图表数据看起来是这样的。
According to this if I create chart then data for the chart will look like this.
Purchase Sales
Jan-2014 3000 6000
我没有任何问题,与这种情况下,
I don't have any issue with this scenario,
不过,让假设我有在美国和放一个分支;我的同事美国的一个创造相同的采购订单和放大器;销售订单,然后我的问题是启动如下:
But Lets Suppose I have one branch in US & one of my US colleague created Same purchase order & sales order then My problem is starts as follows
情景-2
假设这是该方案(目前这款应用程序在美国用于此方案)
Suppose this is the scenario (currently This application is used in US For This scenario)
Lets Say,
**Purchase Order & sales Order Generation is as follows**
Purchase Order(Rs) Sales Order(Rs)
31-Jan-2014 11.30PM 1000 2000
31-Jan-2014 11.00PM 2000 4000
根据这个如果我创建一个图表,然后图表数据看起来是这样的。
According to this If I create a chart then data for the chart will look like this.
Purchase Sales
Feb-2014 3000 6000
这个原因:因为我使用的(UTC + 5.30)的时间来建立采购和放大器;销售报告。
对于谁是坐在美国和放大器的家伙;在日创建采购订单的 31月 - 2014年中午12 结果
(定时对我们来说是UTC)
So According to US, Sales & purchase Order Date is 31-Jan
So According to India, Sales & purchase Order Date is 1-Feb
问:
那么什么是解决这个,我应该在图表中或在整个应用程序中显示,与美国或印度的时间和一些常见的时间是什么标准的方式
因为谁在使用这个应用程序,这个人不会知道什么是UTC终端用户那个人就会只关心正确的值。
Question : Then What is the Standard way to solve this and what should I display in the chart or in the whole application, with the US or with the Indian time or some common time Because end user who is using this application that person will not know what is UTc that person will only interested in the correct values.
感谢您。
任何帮助将AP preciated。
Thank you. Any help will be appreciated.
推荐答案
要处理这些情况,我们应该经常使用的日期时间UTC格式code DateTime.UtcNow
在数据库 GETUTCDATE()
。
To handle these situations we should always use the date time in UTC format in code DateTime.UtcNow
and in database GETUTCDATE()
.
请参考以下链接:
<一个href=\"http://stackoverflow.com/questions/12735759/how-to-handle-time-zones-and-dates-in-multi-country-lingual-application\">how处理多国时区和日期/语言应用程序
<一个href=\"http://msdn.microsoft.com/en-us/library/bb397769.aspx?cs-save-lang=1&cs-lang=csharp#$c$c-snippet-3\" rel=\"nofollow\">http://msdn.microsoft.com/en-us/library/bb397769.aspx?cs-save-lang=1&cs-lang=csharp#$c$c-snippet-3
这篇关于UTC时间应用程序相关的问题,(C#,ASP.NET和放大器; SQL)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!