Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

problem with date\

2 posts in General Discussion Last posting was on 2011-03-29 13:21:24.0Z
cescofranIT Posted on 2011-03-29 09:37:16.0Z
Sender: 1f02.4d91a6b0.1804289383@sybase.com
From: cescofranIT
Newsgroups: sybase.public.ase.general
Subject: problem with date\
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4d91a84c.1f2c.1681692777@sybase.com>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 29 Mar 2011 01:37:16 -0800
X-Trace: forums-1-dub 1301391436 10.22.241.41 (29 Mar 2011 01:37:16 -0800)
X-Original-Trace: 29 Mar 2011 01:37:16 -0800, 10.22.241.41
Lines: 8
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:30077
Article PK: 79305

hi all
i have a problem i want to have in a query the date less 1
month

i try to use this sql

select datadiff ('dd',30,getdate())
go


Luc Van der Veurst Posted on 2011-03-29 13:21:24.0Z
From: "Luc Van der Veurst" <dba_azvub@hotmail.com>
Newsgroups: sybase.public.ase.general
References: <4d91a84c.1f2c.1681692777@sybase.com>
Subject: Re: problem with date\
Lines: 22
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5931
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5931
X-RFC2646: Format=Flowed; Original
X-Forwarded: by - (DeleGate/5.8.7)
X-Forwarded: by - (DeleGate/5.8.7)
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <4d91dcd4$1@forums-1-dub>
Date: 29 Mar 2011 05:21:24 -0800
X-Trace: forums-1-dub 1301404884 10.22.241.152 (29 Mar 2011 05:21:24 -0800)
X-Original-Trace: 29 Mar 2011 05:21:24 -0800, vip152.sybase.com
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:30078
Article PK: 79306

datediff (not datadiff) calculates the difference between 2 dates.

dateadd is what you need.

select dateadd('dd', -30, getdate());
or
select dateadd(mm, -1, getdate()) if you need the previous month.

Luc.

<cescofranIT> wrote in message news:4d91a84c.1f2c.1681692777@sybase.com...
> hi all
> i have a problem i want to have in a query the date less 1
> month
>
> i try to use this sql
>
> select datadiff ('dd',30,getdate())
> go