Chaya

  Here is a simple table structure using DEXTRACT as a computed column.

 

Buddy

 

***********Tbl Struc Starts Here***************

 

CREATE TEMPORARY TABLE `MyTestTbl` +

(`MyTestTblDate1` DATETIME, +

`MyTestTblDate2` DATETIME, +

`MyTestTblDiff` = ((DEXTRACT(MyTestTblDate2)) - (DEXTRACT(MyTestTblDate1))) 
INTEGER)

 

**********Tbl Struc Ends Here***************

 

 

From: [email protected] [mailto:[email protected]] On Behalf Of 
Chaya Goldberg
Sent: Thursday, June 8, 2017 5:46 PM
To: [email protected]
Subject: RE: [RBASE-L] - difference between two dates

 

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]>  
[mailto:[email protected]] On Behalf Of Chaya Goldberg
Sent: Thursday, June 08, 2017 11:36 AM
To: [email protected] <mailto:[email protected]> 
Subject: RE: [RBASE-L] - difference between two dates

 

Thank you, Albert and Thomas!

 

From: [email protected] <mailto:[email protected]>  
[mailto:[email protected]] On Behalf Of Thomas J Hawley
Sent: Wednesday, June 07, 2017 10:42 PM
To: [email protected] <mailto:[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 <[email protected] 
<mailto:[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 <[email protected] 
<mailto:[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 [email protected] 
<mailto:[email protected]> .
For more options, visit 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] 
<mailto:[email protected]> .
For more options, visit 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] 
<mailto:[email protected]> .
For more options, visit 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] 
<mailto:[email protected]> .
For more options, visit 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