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

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
 
K

kkknie

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.
 
Top