VB.Net by API/System.Globalization/CultureInfo — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
(нет различий)
|
Текущая версия на 12:50, 26 мая 2010
Содержание
CultureInfo.DateTimeFormat
Imports System
Imports System.Data
Imports System.Globalization
Public Class Tester
Public Shared Sub Main
Dim amount As Double = 4.52
Dim _date As DateTime = DateTime.Now
Dim info As CultureInfo
For Each info In CultureInfo.GetCultures(CultureTypes.AllCultures)
Console.WriteLine(info.EnglishName)
Console.WriteLine(info.Name)
If Not info.IsNeutralCulture Then
Console.WriteLine(amount.ToString("C", info.NumberFormat))
Console.WriteLine(_date.ToString("d", info.DateTimeFormat))
End If
Next
End Sub
End Class
CultureInfo.GetCultures
Imports System
Imports System.Data
Imports System.Globalization
Public Class Tester
Public Shared Sub Main
Dim amount As Double = 4.52
Dim _date As DateTime = DateTime.Now
Dim info As CultureInfo
For Each info In CultureInfo.GetCultures(CultureTypes.AllCultures)
Console.WriteLine(info.EnglishName)
Console.WriteLine(info.Name)
If Not info.IsNeutralCulture Then
Console.WriteLine(amount.ToString("C", info.NumberFormat))
Console.WriteLine(_date.ToString("d", info.DateTimeFormat))
End If
Next
End Sub
End Class
CultureInfo.NumberFormat
Imports System
Imports System.Data
Imports System.Globalization
Public Class Tester
Public Shared Sub Main
Dim amount As Double = 4.52
Dim _date As DateTime = DateTime.Now
Dim info As CultureInfo
For Each info In CultureInfo.GetCultures(CultureTypes.AllCultures)
Console.WriteLine(info.EnglishName)
Console.WriteLine(info.Name)
If Not info.IsNeutralCulture Then
Console.WriteLine(amount.ToString("C", info.NumberFormat))
Console.WriteLine(_date.ToString("d", info.DateTimeFormat))
End If
Next
End Sub
End Class
New CultureInfo(String inf)
Imports System
Imports System.Data
Imports System.Globalization
Imports System.Threading
public class Test
public Shared Sub Main
Thread.CurrentThread.CurrentCulture = New CultureInfo("de-DE")
Thread.CurrentThread.CurrentUICulture = New CultureInfo("de-DE")
End Sub
End class