ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Month, Day, Year and Day of the Week (https://www.excelbanter.com/excel-programming/433679-month-day-year-day-week.html)

Philosophaie

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

Rick Rothstein

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



Philosophaie

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)


Rick Rothstein

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)



Chip Pearson

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



All times are GMT +1. The time now is 09:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com