Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Month, Day, Year and Day of the Week
Need to know the "Time" functions are correct:
I know Time.Hour=Hour Time.Minute=Minute Time.Second=Second I need to know the correct: Time.???=Month Time.???=Day Time.???=Year Time.???=DayOfWeek |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Month, Day, Year and Day of the Week
What programming language is that? The Excel programming language is VBA
(Visual Basic for Applications) and, in it, the Time function does not have properties. In the VB world, there is a Month, Day, Year, Hour, Minute and Second function that, when passed a real date value, returns the obvious value as per the function's name. As for a DayOfWeek function, that would be the WeekDay function in VB. -- Rick (MVP - Excel) "Philosophaie" wrote in message ... Need to know the "Time" functions are correct: I know Time.Hour=Hour Time.Minute=Minute Time.Second=Second I need to know the correct: Time.???=Month Time.???=Day Time.???=Year Time.???=DayOfWeek |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Month, Day, Year and Day of the Week
Need to read the "day of the week" and when it is "Saturday" or "Sunday". In
VB.net you can use the "Now" function and divide all the parameters "Hour,Minute...Year". I thought I could do it with the time function. "Rick Rothstein" wrote: What programming language is that? The Excel programming language is VBA (Visual Basic for Applications) and, in it, the Time function does not have properties. In the VB world, there is a Month, Day, Year, Hour, Minute and Second function that, when passed a real date value, returns the obvious value as per the function's name. As for a DayOfWeek function, that would be the WeekDay function in VB. -- Rick (MVP - Excel) |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Month, Day, Year and Day of the Week
Sorry, but I am not familiar with VB.NET. In VBA, the Now function returns
not only the current date, it also returns the current time. If Now does the same in VB.NET, then perhaps you can reach the time values using Now.Hour, Now.Minute, Now.Second and Now.DayOfWeek (this is only a guess on my part though, I have no way to test it). -- Rick (MVP - Excel) "Philosophaie" wrote in message ... Need to read the "day of the week" and when it is "Saturday" or "Sunday". In VB.net you can use the "Now" function and divide all the parameters "Hour,Minute...Year". I thought I could do it with the time function. "Rick Rothstein" wrote: What programming language is that? The Excel programming language is VBA (Visual Basic for Applications) and, in it, the Time function does not have properties. In the VB world, there is a Month, Day, Year, Hour, Minute and Second function that, when passed a real date value, returns the obvious value as per the function's name. As for a DayOfWeek function, that would be the WeekDay function in VB. -- Rick (MVP - Excel) |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Month, Day, Year and Day of the Week
VBA has built-in functions for getting components of a date or time: Dim DT As Date Dim YYYY As Long Dim MM As Long Dim DD As Long Dim DDD As String Dim DDDD As String Dim DOW As Long DT = Now YYYY = Year(DT) MM = Month(DT) DD = Day(DT) DDD = Format(DT, "ddd") DDDD = Format(DT, "dddd") DOW = Weekday(DT) Debug.Print DT, YYYY, MM, DD, YYYY, DDD, DDDD, DOW Cordially, Chip Pearson Microsoft Most Valuable Professional Excel Product Group, 1998 - 2009 Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Tue, 15 Sep 2009 20:03:01 -0700, Philosophaie wrote: Need to know the "Time" functions are correct: I know Time.Hour=Hour Time.Minute=Minute Time.Second=Second I need to know the correct: Time.???=Month Time.???=Day Time.???=Year Time.???=DayOfWeek |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Convert Month, Week, Year to date | Excel Worksheet Functions | |||
how to insert month date year and day of week | Excel Discussion (Misc queries) | |||
how to insert month date year and day of week | New Users to Excel | |||
how to insert month date year and day of week | Excel Worksheet Functions | |||
Week/month/year rollovers with PivotTable | Excel Worksheet Functions |