-
Adding 6 months to the month from a date
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
-
On which db system? Use dateadd function in ms sql server.
-
DB2 Query
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
-
You still didn't tell which db system used. Different system has different functions and syntax.
-
-
Smalldate
Originally Posted by 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
select CAST (colmname as smalldatetime) from tablename
-
select CAST (posdt as smalldatetime) from ex
u can use this to trim the datetime
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|