Reply to: Fibbery (flying) () Reputation: 116 2005-2-25 11:42:42 Score: 20 This is easy, if you ignore the day, then use the MON function and the Year of Year to get the month and year, then subtilize the month It is not enough to decline in the year, then, then the year is subtraised, and the result is multiplied by 12 and the month. If you consider DAY, such as 2001/1/1 ~ 2001/3/31, you can think that it is 3 months, you will do it as appropriate on day. Reply to: PBASP (ASPNET) () Reputation: 100 2005-2-25 11:58:59 Score: 20 Yes, Date FDT_DATE11, FDT_DATE2INT Li_CNTLI_CNT = (Year (fdt_date1) - Year (fdt_date2)) * 12 Month ( FDT_DATE1) - MONTH (fdt_date2)
Reply to: hornbilltofy () reputation: 100 2005-2-25 12:37:02 Score: 20 1, PBScript code Write Date fdt_date1, fdt_date2int li_cntli_cnt = (fdt_date1) - Year (fdt_date2)) * 12 Month (fdt_date2) - Month (fdt_date2) 2, using the database handler, if your database is SQL Serve or Sybase: SELECT dateDiff (Month,: fdt_date1,: fdt_date2) INTO: Li_CNT;
Reply to: J9Dai (Code factory) () Reputation: 93 2005-2-25 15:41:51 Score: 20 2001/10/01 to 2002/11/01 at 13 months 2001/10/01 to 2002 / 10/10 days for 12 months? 2001/10/10 to 2002/11/10 days is 12 or 13 months? It seems that the day must be judged! // if result = 13 Then Machine ELSE ↓
Date fdt_date1, fdt_date2int li_Cnt, li_DayFlagif day (fdt_date1) - day (fdt_date2) <0 then li_dayflag = - 1li_Cnt = (year (fdt_date1) - year (fdt_date2)) * 12 month (fdt_date1) - month (fdt_date2) li_dayflag Reply People: DNVIHPL (Happy) () Reputation: 98 2005-2-25 16:17:15 Score: 0 Can you get the number of days away, use this number / 30 get the number of months? Of course, this may not get an integer, you can go all over.