如何在gridview字段中将美国货币和日期格式更改为EU格式 [英] How do I change US currency and date format to EU formats in a gridview field

查看:85
本文介绍了如何在gridview字段中将美国货币和日期格式更改为EU格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的SQL数据库具有美国文化设置,但我位于欧盟。

在我的gridview $和mdy日期格式中显示(也。并且,在数字中交换)。

我可以在某些方面设置这些字段的EU格式吗?



在我的网站上将文化设置为nl-BE无效。< br $> b $ b



谢谢你的帮助。

My SQL DB has US culture settings but I'm based in EU.
In my gridview $ and mdy date format is shown ( also . and , are swapped in numbers).
Can I set the EU formats on these fields somehow?

setting the culture to nl-BE in my website does not help.


thank you for your help.

推荐答案

和mdy日期格式显示(也。并且,以数字交换)。

我可以在某些方面设置这些字段的EU格式吗?



在我的网站上将文化设置为nl-BE无效。< br $> b $ b



感谢您的帮助。
and mdy date format is shown ( also . and , are swapped in numbers).
Can I set the EU formats on these fields somehow?

setting the culture to nl-BE in my website does not help.


thank you for your help.


货币设置如何影响数据库服务器操作。你应该存储数字,而不是代表数字的字符串,不管是不是货币。数字本质上是文化中立的。你需要在ASP.NET中处理数字的呈现,并将线程设置为所需的文化。



实际上,MySQL确实有与文化相关的设置,但它主要与日历有关: http://dev.mysql.com/doc/ refman / 5.0 / en / locale-support.html [ ^ ] http://dev.mysql .com / doc / refman / 5.0 / en / locale-support.html [ ^ ]。



另请注意,即使用不同的文化书写,美元仍然是美元。这一切都取决于你的计算。如果您只计算一种货币,您甚至不需要携带有关单位的信息。如果你使用不同的货币单位运作,真正的问题是(不断变化的)利率。



目前尚不清楚如何将文化设定为nl-BE in我的网站没有帮助。怎么会?当然它确实有所帮助,但是当您在屏幕上显示数字时,文化会发挥作用。请参阅:

http://msdn.microsoft.com/en-us/library/system.threading.thread.currentculture(v=vs.110).aspx [ ^ ],

http://msdn.microsoft.com /en-us/library/system.threading.thread.currentuiculture(v=vs.110).aspx [ ^ ]。



如果执行此操作,您将看到数字数据格式受文化选择的影响。请查看您使用的所有数字类型的 ToString 方法。

参见:

http://msdn.microsoft.com/en-us /library/system.globalization.numberformatinfo.positiveinfinitysymbol(v=vs.110).aspx [ ^ ],

http://msdn.microsoft.com/en-us/library/system.globalization.numberformatinfo。 negativeinfinitysymbol(v = vs.110).aspx [ ^ ]。



这就是你如何得到你的r货币符号: http:// msdn。 microsoft.com/en-us/library/system.globalization.numberformatinfo.currencysymbol%28v=vs.110%29.aspx [ ^ ]。



这样,您的应用程序可以全球化。您不必硬编码美元或欧元字符,您可以根据需要设置当前文化并获取默认货币符号。



-SA
How can it possibly currency setting affect database server operation. You should store numbers, not strings representing numbers, no matter is that currency of not. And numbers, by their nature, are culture-neutral. You need to take care of the presentation of the numbers in ASP.NET, and set the threads to required cultures.

Actually, MySQL does have culture-related settings, but it's mostly related to the calendar: http://dev.mysql.com/doc/refman/5.0/en/locale-support.html[^]http://dev.mysql.com/doc/refman/5.0/en/locale-support.html[^].

Also note that dollars remain dollars even if they are written in different culture. It all depends on what you calculate. If you only calculate the currency of only one kind, you don't even need to carry information on what the units are. And if you do operate with different currency units, the real issue is the (ever changing) rates.

It's not clear how "setting the culture to nl-BE in my website does not help". How come? Of course it does help, but the culture comes into play when you format number for showing them on screen. Please see:
http://msdn.microsoft.com/en-us/library/system.threading.thread.currentculture(v=vs.110).aspx[^],
http://msdn.microsoft.com/en-us/library/system.threading.thread.currentuiculture(v=vs.110).aspx[^].

If you do it, you will see that numeric data formatting is affected by the culture choice. Please see all the ToString methods of the numeric type(s) you use.
See also:
http://msdn.microsoft.com/en-us/library/system.globalization.numberformatinfo.positiveinfinitysymbol(v=vs.110).aspx[^],
http://msdn.microsoft.com/en-us/library/system.globalization.numberformatinfo.negativeinfinitysymbol(v=vs.110).aspx[^].

This is how you get your currency symbol: http://msdn.microsoft.com/en-us/library/system.globalization.numberformatinfo.currencysymbol%28v=vs.110%29.aspx[^].

This way, your application can be globalized. You don't have to hard-code dollar or euro characters, you can set current culture as required and get the default currency symbol.

—SA


我在我的代码中设置了文化,但没有设置文化。我修改了代码,现在没问题。所以这是我的代码中的一个错误。

我通过在我的起始页面上添加一个带有当前文化信息的标签来解决这个问题。
I was setting the culture in my code, but the culture was not set. I modified the code and now it is ok. So it was a bug in my code.
I figured it out by adding a label on my start page with the current culture info.


这篇关于如何在gridview字段中将美国货币和日期格式更改为EU格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆