How to parse the date of a date serial..ex 28 out of 7/28/2004 23:12:00

  • Thread starter Thread starter sorabh
  • Start date Start date
S

sorabh

Guyz
how can i parse out only the "date" from a date serial
in VBA ?

for eg :


SomeFunction(7/28/2004 23:12:00) gives me the number 28


thank
 
I assume you meant day instead of date by your example. If so, use:

Dim i as Integer
Dim dat as Date

dat = "7/28/2004 23:12:00"

i = Day(dat)

MsgBox i

It should give 28 as an answer. You can also use it in a cell using:

=Day(A1)

Where A1 is a date.
 

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