/
aprogrammer
/
dotnet-docs
Обзор
Документация
Войти
/
aprogrammer
/
dotnet-docs
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
samples/snippets/visualbasic/VS_Snippets_CLR/Formatting.HowTo.WeekdayName/vb/example9.vb
30 строк
1 KB
Next Turn
Format codes based on .editorconfig, Part 6 (#18869)
11 июн 2020, 17:41
Не верифицирован
11 июн 2020, 17:41
008c5b8
Код
Авторство
О чём код?
' Visual Basic .NET Document Option Strict On ' <Snippet9> Imports System.Globalization Imports System.Threading Module Example Public Sub Main() Dim dateValue As Date = #6/11/2008# ' Get weekday number using Visual Basic Weekday function Console.WriteLine(Weekday(dateValue)) ' Displays 4 ' Compare with .NET DateTime.DayOfWeek property Console.WriteLine(dateValue.DayOfWeek) ' Displays 3 ' Get weekday name using Weekday and WeekdayName functions Console.WriteLine(WeekdayName(Weekday(dateValue))) ' Displays Wednesday ' Change culture to de-DE Dim originalCulture As CultureInfo = Thread.CurrentThread.CurrentCulture Thread.CurrentThread.CurrentCulture = New CultureInfo("de-DE") ' Get weekday name using Weekday and WeekdayName functions Console.WriteLine(WeekdayName(Weekday(dateValue))) ' Displays Donnerstag ' Restore original culture Thread.CurrentThread.CurrentCulture = originalCulture End Sub End Module ' </Snippet9>