VB.Net by API/System.Globalization/CultureInfo

Материал из VB Эксперт
Перейти к: навигация, поиск

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