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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formula for number of days between two dates

Status
Not open for further replies.

gonenuts

Technical User
Dec 11, 2003
5
0
0
US
Hello, I’m running a report where we need to figure out the number of days between two date fields (in_date and out_date) in an SQL query, then display only those entries over 7 days and I need help figuring the best way to do this in a formula.

Thank You!
 
First part:

"figure out the number of days between two date fields (in_date and out_date) in an SQL query"

+

"then display only those entries over 7 days "

would require a SQL statement. SQL statements depend on database type and crystal version (not available in older versions). SQL statements can be used in selection formulas and sent to the database. If you need help with a SQL statement you need to provide this information.

Then you add

"I need help figuring the best way to do this in a formula"

You can calculate this in a formula and use that to suppress display, but it would be much more efficient to exclude the records returned using a SQL statement.

Lisa


 
Hi,
If you do want to use a formula as the selection criteria, it would be something like:
Code:
({out_date} - {in_date}) > 7

[profile]
 
Int((+Now()-tabe.field-(Int((Now()-table.field)/365))*365/30)

hope this helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top