Normal Topic Need help on Date math (Read 594 times)
esgage
Junior Member
**
Offline


No personal text

Posts: 55
Joined: Dec 8th, 2005
Need help on Date math
Jan 27th, 2006 at 1:03pm
Print Post Print Post  
To whom it may concern:

Please help. I am trying to make an element list a delivery result from 2 elements formated as dates - Date due and Date Shipped. I want the programmed element, Delivery results, to list the delivery result in days. When I program Sesame it will work correctly if the date shipped is sooner than the date due. It will display as a positive number for the days shipped ahead of schedule. Perfect. However, instead of showing a negative number for days late (as in Q & A) it displays some other very large positive number. I am not sure what this result is calculated from.
Is there a different way to program this so it will show a negative number when the Date Shipped is after Date Due?

Currently my program is as simple as the following:
Delivery Results = Date Shipped - Date Due.

Any help would be appreciated.

Thanks,

Kevin E & S Gage
  
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Need help on Date math
Reply #1 - Jan 27th, 2006 at 2:00pm
Print Post Print Post  
Assuming that "Delivery Results" is declared as a number, and that "Date Shipped" and "Date Due" are both actually date types:

Code
Select All
Delivery Results = @ToNumber(Date Shipped) - @ToNumber(Date Due)
 




  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
esgage
Junior Member
**
Offline


No personal text

Posts: 55
Joined: Dec 8th, 2005
Re: Need help on Date math
Reply #2 - Jan 27th, 2006 at 2:25pm
Print Post Print Post  
Thank you!!

That did it. I would never have thought to add the @Tonumber. This Forum is very helpful.

Kevin E & S Gage
  
Back to top
 
IP Logged
 
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: Need help on Date math
Reply #3 - Jan 27th, 2006 at 5:23pm
Print Post Print Post  
Based on this, would the following be the correct way to show the age of an Invoice?
Code
Select All
// Calculates Invoice age in days

Invoice_Age = @ToNumber(@Date) - @ToNumber(Invoice_Date) 

  

**
Captain Infinity
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Need help on Date math
Reply #4 - Jan 27th, 2006 at 7:10pm
Print Post Print Post  
Hello Scott,

Yes that will calculate the difference between the dates.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged