F_AGEINWEEKS

<< F_AGEINMONTHSN | IBExpert UDF Functions | F_AGEINWEEKSISO >>

F_AGEINWEEKS

 
  • compatibility to FreeUDFLib, FreeUDFLibC, FreeUDFLib AvERP
  • Compatible with UTF-8
  • Input TIMESTAMP (older) date optionally time 1, TIMESTAMP (newer) date optionally time 2
  • Output INTEGER difference in (integer) weeks between timestamp 1 and timestamp 2

if you want a negative number if the first date is newer than the second date.

Sunday is 1st day of week. If the two dates are in the same week, the return value is 0.

Example

 SELECT 20 AS ISCORRECT, F_AGEINWEEKS('01.06.2018 15:01:21','15.10.2018 15:01:21') FROM RDB$DATABASE;

Expected results:

    ISCORRECT F_AGEINWEEKS
 ============ ============
           20           20

Example

 SELECT -33 AS ISCORRECT, F_AGEINWEEKS('01.01.2019 15:01:21','15.05.2018 15:01:21') FROM RDB$DATABASE;

Expected results:

    ISCORRECT F_AGEINWEEKS
 ============ ============
          -33          -33

back to top of page
<< F_AGEINMONTHSN | IBExpert UDF Functions | F_AGEINWEEKSISO >>