Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert Month, Week, Year to date Pete Hay Excel Worksheet Functions 3 February 2nd 10 12:43 AM
how to insert month date year and day of week Sachi Noma Excel Discussion (Misc queries) 3 May 19th 06 03:03 AM
how to insert month date year and day of week Sachi Noma New Users to Excel 2 May 19th 06 03:03 AM
how to insert month date year and day of week Sachi Noma Excel Worksheet Functions 3 May 19th 06 03:03 AM
Week/month/year rollovers with PivotTable Rayo K Excel Worksheet Functions 5 December 28th 05 09:25 PM


All times are GMT +1. The time now is 04:51 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"