Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date diff formula returning 2 place decimal 1

Status
Not open for further replies.

cjbrown815

IS-IT--Management
Mar 2, 2006
525
US
Hi,
I have a formula that is calculating the difference between to dates. Works great but I don't need the 2 decimal places and CR won't let me format the number. Any thoughts? Thanks

Formula
datetimevar d1:={SAMPLE.DATE3};
datetimevar d2:={SAMPLE.DATE1};


Datediff("n",d2,d1)/60 /24 & " days"

-CJ

SQL2005// CRXIr2// XP Pro

"Progress lies not in enhancing what is, but in advancing toward what will be"
-KHALIL GIBRAN 1883-1931
 
Do you want to round or truncate?

round(Datediff("n",d2,d1)/60 /24,0) & " days"

-LB
 
Just truncate, thanks LB

-CJ

SQL2005// CRXIr2// XP Pro

"Progress lies not in enhancing what is, but in advancing toward what will be"
-KHALIL GIBRAN 1883-1931
 
truncate(Datediff("n",d2,d1)/60 /24,0) & " days"

-LB
 
No change "519.00 days" I only need the significant value "519" thanks


datetimevar d1:={SAMPLE.DATE3};
datetimevar d2:={SAMPLE.DATE1};


truncate(Datediff("n",d2,d1)/60 /24,0) & " days"

-CJ

SQL2005// CRXIr2// XP Pro

"Progress lies not in enhancing what is, but in advancing toward what will be"
-KHALIL GIBRAN 1883-1931
 
This is just a display issue:

totext(Datediff("n",d2,d1)/60 /24,0,"") & " days"

-LB
 
Thanks, that worked great

resolution

datetimevar d1:={SAMPLE.DATE3};
datetimevar d2:={SAMPLE.DATE1};
totext(Datediff("n",d2,d1)/60 /24,0,"") & " days"

-CJ

SQL2005// CRXIr2// XP Pro

"Progress lies not in enhancing what is, but in advancing toward what will be"
-KHALIL GIBRAN 1883-1931
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top