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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top