Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ' Program: Date and Currency Formats (DateCurrecyFormats)
- ' Author: Joseph L. Bolen
- ' Date Created: Jun 2014
- '
- ' Description: Examine various cultural specific formatting for Date and Currency.
- '
- ' MSDN's Formatting Types in the .NET Framework at: http://msdn.microsoft.com/en-us/library/26etazsy(v=vs.110).aspx
- ' MSDN's Supported Culture Codes at: http://msdn.microsoft.com/en-us/library/hh441729.aspx
- '
- '--------------------------------------------------------------------------------------------------------------
- Imports System.Globalization
- Module Module1
- Sub Main()
- Dim aDate As DateTime = Today
- Dim enUS As New CultureInfo("en-US") ' English (United States)
- Dim enGB As New CultureInfo("en-GB") ' English (United Kingdom)
- Dim bnIN As New CultureInfo("bn-IN") ' Bangla (India)
- Dim esES As New CultureInfo("es-ES") ' Spanish (Spain)
- Dim dede As New CultureInfo("de-de") ' German (Germany)
- Dim frFR As New CultureInfo("fr-FR") ' French (France)
- Dim ja As New CultureInfo("ja") ' Japanese
- Console.WriteLine("Date Formats: ")
- Console.WriteLine()
- Console.WriteLine("Short Date ""d"": " & aDate.ToString("d"))
- Console.WriteLine("Short Date ""d"" with CultureInfo.InvariantCulture: " & aDate.ToString("d", CultureInfo.InvariantCulture))
- Console.WriteLine()
- Console.WriteLine("Short Date ""d"" with English (United States) Culture code ""en-US"": " & aDate.ToString("d", enUS))
- Console.WriteLine("Short Date ""d"" with English (United Kingdom) Culture code ""en-GB"": " & aDate.ToString("d", enGB))
- Console.WriteLine("Short Date ""d"" with Bangla (India) Culture code ""bn-IN"": " & aDate.ToString("d", bnIN))
- Console.WriteLine("Short Date ""d"" with Spanish (Spain) Culture code ""es-ES"": " & aDate.ToString("d", esES))
- Console.WriteLine("Short Date ""d"" with German (Germany) Culture code ""de-de"": " & aDate.ToString("d", dede))
- Console.WriteLine("Short Date ""d"" with French (France) Culture code ""fr-FR"": " & aDate.ToString("d", frFR))
- Console.WriteLine("Short Date ""d"" with Japanese Culture code ""ja"": " & aDate.ToString("d", ja))
- ' Pause for input to read console.
- Console.WriteLine()
- Console.WriteLine("Press any key to continue: ")
- Console.ReadKey()
- Dim aCurrencyValue As Double = 1234.789
- Console.WriteLine()
- Console.WriteLine("Currency Formats: ")
- Console.WriteLine()
- Console.WriteLine("Currency""c"": " & aCurrencyValue.ToString("c"))
- Console.WriteLine("Currency""c"" with CultureInfo.InvariantCulture: " & aCurrencyValue.ToString("c", CultureInfo.InvariantCulture))
- Console.WriteLine()
- Console.WriteLine("Currency""c"" with (English) United States Culture code ""en-US"": " & aCurrencyValue.ToString("c", enUS))
- Console.WriteLine("Currency""c"" with English (United Kingdom) Culture code ""en-GB"": " & aCurrencyValue.ToString("c", enGB))
- Console.WriteLine("Currency""c"" with Bangla (India) Culture code ""bn-IN"": " & aCurrencyValue.ToString("c", bnIN))
- Console.WriteLine("Currency""c"" with Spanish (Spain) Culture code ""es-ES"": " & aCurrencyValue.ToString("c", esES))
- Console.WriteLine("Currency""c"" with German (Germany) Culture code ""de-de"": " & aCurrencyValue.ToString("c", dede))
- Console.WriteLine("Currency""c"" with French (France) Culture code ""fr-FR"": " & aCurrencyValue.ToString("c", frFR))
- Console.WriteLine("Currency""c"" with Japanese Culture code ""ja"": " & aCurrencyValue.ToString("c", ja))
- ' Pause for input to read console.
- Console.WriteLine()
- Console.WriteLine("Press any key to end program: ")
- Console.ReadKey()
- End Sub
- End Module
Advertisement
Add Comment
Please, Sign In to add comment