Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - - 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
From: cescofranIT
Newsgroups: sybase.public.ase.general
Subject: problem with date\
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <>
Date: 29 Mar 2011 01:37:16 -0800
X-Trace: forums-1-dub 1301391436 (29 Mar 2011 01:37:16 -0800)
X-Original-Trace: 29 Mar 2011 01:37:16 -0800,
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

i try to use this sql

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

Luc Van der Veurst Posted on 2011-03-29 13:21:24.0Z
From: "Luc Van der Veurst" <>
Newsgroups: sybase.public.ase.general
References: <>
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)
Message-ID: <4d91dcd4$1@forums-1-dub>
Date: 29 Mar 2011 05:21:24 -0800
X-Trace: forums-1-dub 1301404884 (29 Mar 2011 05:21:24 -0800)
X-Original-Trace: 29 Mar 2011 05:21:24 -0800,
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());
select dateadd(mm, -1, getdate()) if you need the previous month.


<cescofranIT> wrote in message
> 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