# Miscellaneous > Structured Query Language (SQL) >  Adding 6 months to the month from a date

## Jayshree

Hi, 

     I want to select all records that would have a maturity date that falls within the 6 month from the current month or selecting all records that would mature in the 6 month from the current month. 

Thanks

----------


## rmiao

On which db system? Use dateadd function in ms sql server.

----------


## Jayshree

First I want to add 6 months to the current date and then extract the month and year from the resulting date.When I run these queries(given below) separately, it works fine, but could someone tell me how to trim the day out of this date. 

SELECT month( ADD_MONTHS(CURRENT_TIMESTAMP,6)) from SYSIBM.SYSDUMMY1

SELECT year( ADD_MONTHS(CURRENT_TIMESTAMP,6)) from SYSIBM.SYSDUMMY1

----------


## rmiao

You still didn't tell which db system used. Different system has different functions and syntax.

----------


## Jayshree

I an using DB2.

----------


## dheena

> First I want to add 6 months to the current date and then extract the month and year from the resulting date.When I run these queries(given below) separately, it works fine, but could someone tell me how to trim the day out of this date. 
> 
> SELECT month( ADD_MONTHS(CURRENT_TIMESTAMP,6)) from SYSIBM.SYSDUMMY1
> 
> SELECT year( ADD_MONTHS(CURRENT_TIMESTAMP,6)) from SYSIBM.SYSDUMMY1


select CAST (colmname as smalldatetime) from tablename

----------


## dheena

select CAST (posdt as smalldatetime) from ex

u can use this to trim the datetime

----------

