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!

Coding for Leap Year

Status
Not open for further replies.

Cambridgehomes

IS-IT--Management
Oct 28, 2004
1
US
Below is a formula w are using, but we are having a problem with the code failing on leap year. Does anyone have a work around code to correct this problem

NumberVar YYYY;
NumberVar MM;
NumberVar DD;

YYYY := Truncate({WDWB1.WDA004} / 10000);
MM := Truncate(({WDWB1.WDA004} - (YYYY * 10000)) / 100);
DD := Truncate(({WDWB1.WDA004} - ( YYYY * 10000)) - (MM * 100));

local datevar LTM := Date(YYYY,MM,DD);

//record selection formula
LTM in Date(year(CurrentDate)-1,mm,dd) to (currentdate)
 
Use Dateserial.

LTM in dateserial(year(currentdate),mm-12,dd) to currentdate
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top