Date for this month

S

SAC

I get data from a mainframe. The date is in this format:

20051003.

How can I build a where clause in a sql statement to only return the records
for this month, using the system time.

Would I use datepart(). Just not sure on how to handle it when it's in this
format.

Should I change it using dateserial?

Any help would be appreciated.

Thanks.
 
S

SAC

I started using datepart and for year it returns 279.

This is what I did:
varYear = Datepart("y",Now())

How can I get it to return 2005?

Thanks.
 
K

Klatuu

varYear = Datepart("yyyy",Now())

SAC said:
I started using datepart and for year it returns 279.

This is what I did:
varYear = Datepart("y",Now())

How can I get it to return 2005?

Thanks.
 
M

Marshall Barton

SAC said:
I get data from a mainframe. The date is in this format:

20051003.

How can I build a where clause in a sql statement to only return the records
for this month, using the system time.


Try using the criteria:

Like Format(Date(), "yyyymm\*")
 
Top