datePart Function

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi there,

Is there DatePart function, like that found in MS Access, which enables me
to separate day, month and year, filtering then, on specific parts of a date?
 
=TEXT(cell name containing date,"dddd")

use "mmm" for abbrev. month name
use "yyyy" for year

I think this will work for what you want.

Brent
 
Hi Carlee,

The DatePart function is available in Excel VBA.

Sub test()
Dim iDay As Integer
Dim iYear As Integer
Dim iMonth As Integer

iYear = DatePart("yyyy", Now)
iMonth = DatePart("m", Now)
iDay = DatePart("d", Now)

'or you can also use:
iYear = Year(Now)
iMonth = Month(Now)
iDay = Day(Now)

End Sub
 
Back
Top