Chaya,

Use the DEXTRACT function to just use DATE portion of the DATETIME.

HELP DEXTRACT should explain it all.

Feel free to reach out to me if you need further help or a sample to illustrate the use of such function.

Very Best R:egards,

Razzak


At 05:46 PM 6/8/2017, Chaya Goldberg wrote:



Hi, I’m still having trouble with this. I’m doing the subtraction in a select statement (generating a computed column in a temporary table), and getting the difference in datetime format! As in ‘01/02/1900 12:00 AM’ instead of 2.

Any ideas as to how I can display it as an integer? (besides for creating the temporary table first, then inserting the values. I tried that, but it’s having other unclear issues, so was wondering if there’s a direct way to do this.)

Thanks.
Chaya

From: [email protected] [mailto:[email protected]] On Behalf Of Chaya Goldberg
Sent: Thursday, June 08, 2017 11:36 AM
To: [email protected]
Subject: RE: [RBASE-L] - difference between two dates

Thank you, Albert and Thomas!

From: <mailto:[email protected]>[email protected] [mailto:[email protected]] On Behalf Of Thomas J Hawley
Sent: Wednesday, June 07, 2017 10:42 PM
To: <mailto:[email protected]>[email protected]
Subject: Re: [RBASE-L] - difference between two dates

Keeping in mind that if you want the number of days between two dates, and deem the first and last days inclusive, you'll need to add 1 to the result.
Tom Hawley

On Wed, Jun 7, 2017 at 5:49 PM, Albert Berry <<mailto:[email protected]>[email protected]> wrote:
R>SET VAR vDate2 DATE = 2017/06/06

R>SET VAR vDate1 DATE = 2017/06/01

R>SET VAR vDiff INTEGER = (.vDate2 - .vDate1)

R>SHOW VAR vD%
Variable = Value Type -------------------------------- ------------------------------ ------- vDir = -0- TEXT vDate2 = 2017/06/06 DATE vDate1 = 2017/06/01 DATE vDiff = 5 INTEGER


On Jun 7, 2017, at 3:33 PM, Chaya Goldberg <<mailto:[email protected]>[email protected]> wrote:

Hi All,

I feel like this should be obvious, but can’t figure out how to do it. Is there a function that returns the difference between two dates in integer format, like datediff in SQL?

Thanks in advance,
Chaya

--
You received this message because you are subscribed to the Google Groups "RBASE-L" group. To unsubscribe from this group and stop receiving emails from it, send an email to <mailto:[email protected]>[email protected]. For more options, visit <https://groups.google.com/d/optout>https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "RBASE-L" group. To unsubscribe from this group and stop receiving emails from it, send an email to <mailto:[email protected]>[email protected]. For more options, visit <https://groups.google.com/d/optout>https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "RBASE-L" group. To unsubscribe from this group and stop receiving emails from it, send an email to <mailto:[email protected]>[email protected]. For more options, visit <https://groups.google.com/d/optout>https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "RBASE-L" group. To unsubscribe from this group and stop receiving emails from it, send an email to <mailto:[email protected]>[email protected]. For more options, visit <https://groups.google.com/d/optout>https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "RBASE-L" group. To unsubscribe from this group and stop receiving emails from it, send an email to <mailto:[email protected]>[email protected]. For more options, visit <https://groups.google.com/d/optout>https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups 
"RBASE-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to