Как получить название дня недели
Категория: Basic
2012-11-30 16:18:11
code: #vba
DayNameLocal = Format(Now, "DDDD")
code: #vba
Private Sub GetDayName() MsgBox DayNameLocal(#5/22/2005#), , "День:" End Sub Private Function DayNameLocal$(iDate As Date) DayNameLocal$ = StrConv(Format(iDate, "DDDD"), vbProperCase) End Function
code: #vba
DayNameRus = Choose(WeekDay(Now, vbMonday), _ "Понедельник", "Вторник", "Среда", "Четверг", "Пятница", "Суббота", "Воскресенье")
code: #vba
Private Sub GetDayName() MsgBox DayNameRus(#1/22/2005#), , "День:" End Sub Private Function DayNameRus$(iDate As Date) DayNameRus$ = Choose(WeekDay(iDate, vbMonday), _ "Понедельник", "Вторник", "Среда", "Четверг", "Пятница", "Суббота", "Воскресенье") End Function
code: #vba
DayNameRus = Array("", "Понедельник", "Вторник", "Среда", _ "Четверг", "Пятница", "Суббота", "Воскресенье")(WeekDay(iDate, vbMonday))
code: #vba
DayNameRus = Array("Понедельник", "Вторник", "Среда", _ "Четверг", "Пятница", "Суббота", "Воскресенье")(WeekDay(iDate, vbMonday) - 1)
code: #vba
DayNameRus = Array("Воскресенье", "Понедельник", _ "Вторник", "Среда", "Четверг", "Пятница", "Суббота")(WeekDay(iDate) - 1)
code: #vba
Private Sub GetDayName() MsgBox DayNameRus(#7/22/2005#), , "День:" End Sub Private Function DayNameRus$(iDate As Date) DayNameRus$ = Array("", "Понедельник", "Вторник", _ "Среда", "Четверг", "Пятница", "Суббота", "Воскресенье")(WeekDay(iDate, vbMonday)) End Function
code: #vba
Private Sub GetDayName() MsgBox DayNameRus(#7/22/2005#), , "День:" End Sub Private Function DayNameRus$(iDate As Date) DayNameRus$ = Array("Понедельник", "Вторник", "Среда", _ "Четверг", "Пятница", "Суббота", "Воскресенье")(WeekDay(iDate, vbMonday) - 1) End Function
code: #vba
Option Base 1 Private Sub GetDayName() MsgBox DayNameRus(#7/22/2005#), , "День:" End Sub Private Function DayNameRus$(iDate As Date) DayNameRus$ = Array("Понедельник", "Вторник", _ "Среда", "Четверг", "Пятница", "Суббота", "Воскресенье")(WeekDay(iDate, vbMonday)) End Function
code: #vba
DayNameLocal = WeekdayName(Weekday(Now, vbMonday))
code: #vba
Private Sub GetDayName() MsgBox DayNameLocal(#8/15/2005#), , "День:" End Sub Private Function DayNameLocal$(iDate As Date) DayNameLocal$ = WeekdayName(Weekday(iDate, vbMonday)) ' Только для Microsoft Excel 2000 и старше End Function
code: #vba
For iDay = 1 To 7 DayNameLocal = WeekdayName(iDay) 'понедельник Mid(DayNameLocal, 1, 1) = UCase(DayNameLocal) 'Понедельник MsgBox DayNameLocal 'WeekdayName(iDay) Next
code: #vba
DayNameLocal = Application.GetCustomListContents(2)(Weekday(Now, vbMonday))
code: #vba
ComboBox1.List = Application.GetCustomListContents(1)
code: #vba
ListBox1.List = Application.GetCustomListContents(2)
code: #vba
DayNameEng = Application.Text(Now, "DDDD")
code: #vba
DayNameEng = WorksheetFunction.Text(Date, "DDDD")
code: #vba
DayNameEng = [TEXT(TODAY(),"DDDD")]
code: #vba
Private Declare Sub VarWeekdayName Lib "oleaut32.dll" ( _ ByVal iWeekday As Long, _ ByVal fAbbrev As Long, _ ByVal iFirstDay As Long, _ ByVal dwFlags As Long, _ ByRef pbstrOut As String) Private Function DayNameLocal$(iDate As Date) VarWeekdayName Weekday(iDate), 0&, 1&, 0&, DayNameLocal 'VarWeekdayName Weekday(iDate, vbMonday), 0&, 0&, 0&, DayNameLocal 'fAbbrev = 0& - вторник; = 1& - Вт DayNameLocal = StrConv(DayNameLocal, vbFromUnicode) End Function Private Sub GetDayName() MsgBox DayNameLocal(Now), , "День:" End Sub
автор: Климов Павел Юрьевич
Поделиться: