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.

calculate the no of month(s) between two different date

3 posts in Windows NT Last posting was on 1998-05-12 08:21:25.0Z
Frankiel Posted on 1998-05-12 01:52:13.0Z
From: "Frankiel" <frankiel@pitl.com>
Subject: calculate the no of month(s) between two different date
Date: Tue, 12 May 1998 09:52:13 +0800
Lines: 13
X-Newsreader: Microsoft Outlook Express 4.72.2106.4
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4
Message-ID: <vaDNu#Tf9GA.155@forums.powersoft.com>
Newsgroups: sybase.public.sqlserver.nt
Path: forums-1-dub!forums-master.sybase.com!forums.powersoft.com
Xref: forums-1-dub sybase.public.sqlserver.nt:5023
Article PK: 1092381

hello,

I want to calculate the no of month(s) between two different date, for
example,
the no of months between "13/05/97" and "24/04/98". I know powerbuilder
provide
"daysafter" to calculate the no of days between two different dates.

frankie


Luis Cordeiro Posted on 1998-05-12 08:17:56.0Z
From: "Luis Cordeiro" <luis_cordeiro@mail.amsinc.com>
References: <vaDNu#Tf9GA.155@forums.powersoft.com>
Subject: Re: calculate the no of month(s) between two different date
Date: Tue, 12 May 1998 09:17:56 +0100
Lines: 37
X-Newsreader: Microsoft Outlook Express 4.72.2106.4
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4
Message-ID: <giHcjUXf9GA.154@forums.powersoft.com>
Newsgroups: sybase.public.sqlserver.nt
Path: forums-1-dub!forums-master.sybase.com!forums.powersoft.com
Xref: forums-1-dub sybase.public.sqlserver.nt:5022
Article PK: 1092388

If you check the online manuals on «Months», you will have a list of date
and time related functions:

MONTHS( date-expr, date-expr ) Returns the number of whole months from the
first date to the second date. The number may be negative. Hours, minutes
and seconds are ignored.

MONTHS( date-expr, integer-expr ) Add integer-expr months to the given
date. If the new date is past the end of the month (such as
MONTHS('1992-01-31', 1) ) the result is set to the last day of the month. If
the integer-expr is negative, the appropriate number of months are
subtracted from the date. Hours, minutes and seconds are ignored.


... I gess you want the first one.

Luis Cordeiro

Frankiel wrote in message ...
>hello,
>
>I want to calculate the no of month(s) between two different date, for
>example,
>the no of months between "13/05/97" and "24/04/98". I know powerbuilder
>provide
>"daysafter" to calculate the no of days between two different dates.
>
>frankie
>
>
>
>


Luis Cordeiro Posted on 1998-05-12 08:21:25.0Z
From: "Luis Cordeiro" <luis_cordeiro@mail.amsinc.com>
References: <vaDNu#Tf9GA.155@forums.powersoft.com> <giHcjUXf9GA.154@forums.powersoft.com>
Subject: Re: calculate the no of month(s) between two different date
Date: Tue, 12 May 1998 09:21:25 +0100
Lines: 36
X-Newsreader: Microsoft Outlook Express 4.72.2106.4
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4
Message-ID: <BIF3gWXf9GA.107@forums.powersoft.com>
Newsgroups: sybase.public.sqlserver.nt
Path: forums-1-dub!forums-master.sybase.com!forums.powersoft.com
Xref: forums-1-dub sybase.public.sqlserver.nt:5021
Article PK: 1092387

I am sorry, wrong information here (this was for the SQLAny).

You could use the DATEDIFF(MONTH,date-expr1,date-expr2), where MONTH is the
datepart you want the result to be.

Luis Cordeiro

Luis Cordeiro wrote in message ...
>
>If you check the online manuals on «Months», you will have a list of date
>and time related functions:
>
>MONTHS( date-expr, date-expr ) Returns the number of whole months from
the
>first date to the second date. The number may be negative. Hours, minutes
>and seconds are ignored.
>
>MONTHS( date-expr, integer-expr ) Add integer-expr months to the given
>date. If the new date is past the end of the month (such as
>MONTHS('1992-01-31', 1) ) the result is set to the last day of the month.
If
>the integer-expr is negative, the appropriate number of months are
>subtracted from the date. Hours, minutes and seconds are ignored.
>
>
>... I gess you want the first one.
>
>Luis Cordeiro
>
>