![]() |
![]() ![]() ![]() |
|
![]() ![]() ![]() ![]() ![]() |
![]() ![]() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Functions enclosed in FreeAdhocUDF.dll/.so/.dylib : | ||
Date-time functions | 139 functions and 27 variants | |
Preliminary note | ||
Calculate | 11 functions | |
Determin | 78 functions and 23 variants | |
Format | 16 functions and 4 variants | |
Compare | 4 functions | |
Convert | 7 functions | |
movable feasts | 14 functions | |
![]() |
doesn't run with InterBase | |
![]() |
returns <null> instead of 0, '' (empty string) or '17.11.1858' | |
![]() |
since InterBase 6.0 this function is substitutable with a native SQL statement | |
![]() |
since FireBird 1.0 this function is substitutable with a native SQL statement | |
![]() |
since FireBird 2.1 this function is substitutable with a native SQL statement | |
Output
RETURN
mechanism if nothing other is published: FREE_IT TestSQLs with NULL run only in FireBird 2. |
Date-time functions: Preliminary note | ||
![]() |
||
For calculation
of time there are used different dates. The most importent are - Julian Date (JD) - modified Julian Date (MJD) - Dubliner Julian Date (DJD) - ANSI Date - UNIX Time (POSIX-Standard) The Julian Date (JD) is a continuous count of days and fractions elapsed since 1st Januar -4712 12:00. For example the 1st Januar 2000 12:00 is the julian date 2.451.545,0. The julian date did'nt mistake with a date in the julian calendar. As a continious count of days the julian date is free of irregularities like leap days, different length of month a.s.o. you can find in most of calendars. It is used mostly in astronomy to describe time-dependents for easy calculation of time-differences. In international geophysical year (1957/1958) a modified Julian Date (mJD oder MJD) was established with zeropoint at 1985-11-17 0:00 UT(worldtime): MJD = JD – 2.400.000,5. It was first used to record the orbit of Sputnik via an IBM 704 (36-bit machine). Digital Equipment Corporation (DEC) used MJD in their OS VMS and their database Rdb/VMS, on which Jim Starkey cooperated before he leaves DEC and programmed his own RDBMS (relational database management system) (Groton DataBase), which becomes InterBase. MJD is mainly used in geodesy, geophysics and space flight, but not become accepted in astronomy. The Dublin Julian Date (DJD) is another version of the Julian Date. The count of days started with the beginning of the year 1900 (used in Microsoft Excel, Lotus-123, Delphi) or the the year 1904 (Microsoft Excel for Mac OS). Because the count starts on 1st Januar with 1, the correct zeropoint is 1899-12-31 0:00. Some programms make more confusion because they use 1900 as a leap year and therefore their dates after 28th february 1900 are wrong (zeropoint form them is 1899-12-30 0:00). The ANSI-Date starts with 1st januar 1601 as day „1“. It's used in COBOL. Unix time, or POSIX time, is a system for describing points in time: it is the number of seconds elapsed since midnight UTC of January 1, 1970, not counting leap seconds. This starting-time is called The EPOCH. It is widely used not only on Unix-like operating systems but also in many other computing systems. (look http://en.wikipedia.org/wiki/Julian_date and http://en.wikipedia.org/wiki/Unix_time) InterBase and FireBird uses the modified Julian Date with 1858-11-17 as day 0. |
Date-time functions: Compare | ||
![]() |
||
F_MAXDATE | compatibility
to
FreeUDFLib,
FreeUDFLibC, FreeUDFLib AvERP input/output-compatibility to rFunc (MAXDATE) |
|
Entrypoint | maxdate | compatible with UTF-8 |
Input | TIMESTAMP TIMESTAMP |
date
optionally
time 1 date optionally time 2 |
Output | TIMESTAMP | the newer date |
TestSQL SELECT '01.10.2005 15:00:00' AS ISCORRECT, F_MAXDATE('22.08.2000 14:38:12', '01.10.2005 15:00:00') FROM RDB$DATABASE; SELECT NULL AS ISCORRECT, F_MAXDATE(NULL, NULL) FROM RDB$DATABASE; |
||
![]() ![]() |
||
F_MINDATE | compatibility
to
FreeUDFLib,
FreeUDFLibC, FreeUDFLib AvERP input/output-compatibility to rFunc (MINDATE) |
|
Entrypoint | mindate | compatible with UTF-8 |
Input | TIMESTAMP TIMESTAMP |
date
optionally
time 1 date optionally time 2 |
Output | TIMESTAMP | the older date |
TestSQL SELECT '22.08.2000 14:38:12' AS ISCORRECT, F_MINDATE('22.08.2000 14:38:12', '01.10.2005 15:00:00') FROM RDB$DATABASE; SELECT NULL AS ISCORRECT, F_MINDATE(NULL, NULL) FROM RDB$DATABASE; |
||
![]() ![]() |
||
F_EQUALDATE | compatibility to zu FreeUDFLib AvERP, GrUDF | |
Entrypoint | equaldate | compatible with UTF-8 |
Input | TIMESTAMP TIMESTAMP |
date
optionally
time 1 date optionally time 2 |
Output | INTEGER | 1 = date is equal, 0 = date is not equal |
Tested only
on date (time
could be entered but never used) TestSQL SELECT 1 AS ISCORRECT, F_EQUALDATE('20.02.2004 10:00:00', '20.02.2004 11:00:00') FROM RDB$DATABASE; SELECT 0 AS ISCORRECT, F_EQUALDATE('20.02.2004 10:00:00', '21.02.2004 11:00:00') FROM RDB$DATABASE; SELECT NULL AS ISCORRECT, F_EQUALDATE(NULL, NULL) FROM RDB$DATABASE; |
||
![]() ![]() |
||
F_EQUALDATETIME | compatibility
to
FreeUDFLib AvERP, GrUDF input/output-compatibility to rFunc (DTEQUAL) |
|
Entrypoint | equaldatetime | compatible with UTF-8 |
Input | TIMESTAMP TIMESTAMP |
date
optionally
time 1 date optionally time 2 |
Output | INTEGER | 1 =timestamp is equal, 0 = timestamp is not equal |
Testet
on date and
time TestSQL SELECT 1 AS ISCORRECT, F_EQUALDATETIME('20.02.2004 10:00:00', '20.02.2004 10:00:00') FROM RDB$DATABASE; SELECT 0 AS ISCORRECT, F_EQUALDATETIME('20.02.2004 10:00:00', '20.02.2004 11:00:00') FROM RDB$DATABASE; SELECT NULL AS ISCORRECT, F_EQUALDATETIME(NULL, NULL) FROM RDB$DATABASE; |
||
![]() ![]() |
Date-time functions: Convert | ||
![]() |
||
F_STRTOTIME | compatibility to FreeUDFLibC | |
Entrypoint | strtotime | compatible with UTF-8 |
Input | CSTRING(11) | british/american time (f.e. 05:04:01 AM) as string |
Output | TIME | time in format 24 hours |
Inputformat
could be with one or two digits and the separation from AM/PM with
or
without blanks, AM/PM must be entered in capital letters. TestSQL SELECT '05:04:01' AS ISCORRECT, F_STRTOTIME('05:04:01 AM') FROM RDB$DATABASE; SELECT '17:04:01' AS ISCORRECT, F_STRTOTIME('5:4:1PM') FROM RDB$DATABASE; SELECT NULL AS ISCORRECT, F_STRTOTIME(NULL) FROM RDB$DATABASE; |
||
![]() ![]() |
||
F_DATETODOUBLE | input/output-compatibility to rFunc (DATETODOUBLE) | |
Entrypoint | datetodouble | compatible with UTF-8 |
Input | TIMESTAMP | date optionally time |
Output | DOUBLE | timestamp as floatingpoint (infront of dot date, after dot time; 1.0 = 24 h) |
TestSQL SELECT 54205.59375 AS ISCORRECT, F_DATETODOUBLE('15.04.2007 14:15:00') FROM RDB$DATABASE; SELECT NULL AS ISCORRECT, F_DATETODOUBLE(NULL) FROM RDB$DATABASE; |
||
![]() ![]() |
||
F_TIMETODOUBLE | input/output-compatibility to rFunc (TIMETODOUBLE) | |
Entrypoint | timetodouble | compatible with UTF-8 |
Input | TIMESTAMP | date optionally time |
Output | DOUBLE | timestamp as floatingpoint (infront of dot 0, after dot time; 1.0 = 24 h) |
TestSQL SELECT 0.59375 AS ISCORRECT, F_TIMETODOUBLE('15.04.2007 14:15:00') FROM RDB$DATABASE; SELECT NULL AS ISCORRECT, F_TIMETODOUBLE(NULL) FROM RDB$DATABASE; |
||
![]() ![]() |
||
F_DOUBLETODATE | input/output-compatibility to rFunc (DOUBLETODATE) | |
Entrypoint | doubletodate | compatible with UTF-8 |
Input | DOUBLE | timestamp as floatingpoint (infront of dot date, after dot time; 1.0 = 24 h) |
Output | TIMESTAMP | timestamp |
rFunc uses
modified julian calendar (0 =
17.11.1858
00:00:00) Because of this with date 0 returns 31.12.1899 instead of
17.11.1858. TestSQL SELECT '15.04.2007 14:15:00' AS ISCORRECT, F_DOUBLETODATE(54205.59375) FROM RDB$DATABASE; SELECT NULL' AS ISCORRECT, F_DOUBLETODATE(NULL) FROM RDB$DATABASE; |
||
![]() ![]() |
||
F_DOUBLETOTIME | input/output-compatibility to rFunc (DOUBLETOTIME) | |
Entrypoint | doubletotime | compatible with UTF-8 |
Input | DOUBLE | timestamp as floatingpoint (infront of dot date, after dot time; 1.0 = 24 h) |
Output | TIMESTAMP | timestamp |
Uses from input
only digits after dot (the
time-part). rFunc uses modified julian calendar (0 = 17.11.1858 00:00:00) Because of this with date 0 returns 31.12.1899 instead of 17.11.1858. TestSQL SELECT '31.12.1899 14:15:00' AS ISCORRECT, F_DOUBLETOTIME(0.59375) FROM RDB$DATABASE; SELECT NULL AS ISCORRECT, F_DOUBLETOTIME(NULL) FROM RDB$DATABASE; |
||
![]() ![]() |
||
F_PERIOD2SECONDS | function from adhoc | |
Entrypoint | period2seconds | compatible with UTF-8 |
Input | CSTRING(254) | period in pattern [d]:h:m:s |
Output | INTEGER | period in seconds |
Periods could be
enter with 2- or 1digits
interval (dd:hh:mm:ss or d:h:m:s). Negative periods starts with a "-" in front. Periods with pattern days:hours:minutes:seconds (4 intervalls) or hours:minutes:seconds (3 intervalls) are allowed. The output of periods with less than 3 intervalls or containing other characters is <null> or empty string. For input also f.e. '0:26:0:0' instead of '1:2:0:0' alllowed for 26 hours. TestSQL SELECT 4205 AS ISCORRECT, F_PERIOD2SECONDS('0:1:10:5') FROM RDB$DATABASE; SELECT NULL AS ISCORRECT, F_PERIOD2SECONDS(NULL) FROM RDB$DATABASE; |
||
![]() ![]() |
||
F_SECONDS2PERIOD | function from adhoc | |
Entrypoint | seconds2period | compatible with UTF-8 |
Input | INTEGER | seconds of a period |
Output | CSTRING(254) | period in pattern d:h:m:s |
The output is
allways in pattern
days:hours:minutes:seconds (4 * 2 digit intervalls). Negativ periods starts with "-". TestSQL SELECT '00:01:10:05' AS ISCORRECT, F_SECONDS2PERIOD(4205) FROM RDB$DATABASE; SELECT '-00:01:10:05' AS ISCORRECT, F_SECONDS2PERIOD(-4205) FROM RDB$DATABASE; SELECT NULL AS ISCORRECT, F_SECONDS2PERIOD(NULL) FROM RDB$DATABASE; |
||
![]() ![]() |
Date-time functions: movable feasts | ||
![]() |
||
F_WEIBERFASTNACHT | function from adhoc | |
Entrypoint | weiberfastnacht | compatible with UTF-8 |
Input | INTEGER | year |
Output | DATE | date of Carnival Dirty Thuresday of the year |
TestSQL SELECT '15.02.2007' AS ISCORRECT, F_WEIBERFASTNACHT(2007) FROM RDB$DATABASE; SELECT NULL AS ISCORRECT, F_WEIBERFASTNACHT(NULL) FROM RDB$DATABASE; |
||
![]() ![]() |
||
F_ROSENMONTAG | function
from adhoc |
|
Entrypoint | rosenmontag | compatible with UTF-8 |
Input | INTEGER | year |
Output | DATE | date of Carnival Monday of the year |
TestSQL SELECT '19.02.2007' AS ISCORRECT, F_ROSENMONTAG(2007) FROM RDB$DATABASE; SELECT NULL AS ISCORRECT, F_ROSENMONTA(NULL) FROM RDB$DATABASE; |
||
![]() ![]() |
||
F_KARNEVALSDIENSTAG | function
from adhoc |
|
Entrypoint | karnevalsdienstag | compatible with UTF-8 |
Input | INTEGER | year |
Output | DATE | date of Mardi Gras of the year |
TestSQL SELECT '20.02.2007' AS ISCORRECT, F_KARNEVALSDIENSTAG(2007) FROM RDB$DATABASE; SELECT NULL AS ISCORRECT, F_KARNEVALSDIENSTAG(NULL) FROM RDB$DATABASE; |
||
![]() ![]() |
||
F_ASCHERMITTWOCH | function
from adhoc |
|
Entrypoint | aschermittwoch | compatible with UTF-8 |
Input | INTEGER | year |
Output | DATE | date of Ash Wednesday of the year |
TestSQL SELECT '21.02.2007' AS ISCORRECT, F_ASCHERMITTWOCH(2007) FROM RDB$DATABASE; SELECT NULL AS ISCORRECT, F_ASCHERMITTWOCH(NULL) FROM RDB$DATABASE; |
||
![]() ![]() |
||
F_PALMSONNTAG | function
from adhoc |
|
Entrypoint | palmsonntag | compatible with UTF-8 |
Input | INTEGER | year |
Output | DATE | date of Palm Sunday of the year |
TestSQL SELECT '01.04.2007' AS ISCORRECT, F_PALMSONNTAG(2007) FROM RDB$DATABASE; SELECT NULL AS ISCORRECT, F_PALMSONNTAG(NULL) FROM RDB$DATABASE; |
||
![]() ![]() |
||
F_GRUENDONNERSTAG | function
from adhoc |
|
Entrypoint | gruendonnerstag | compatible with UTF-8 |
Input | INTEGER | year |
Output | DATE | date of Holy Thursday of the year |
TestSQL SELECT '05.04.2007' AS ISCORRECT, F_GRUENDONNERSTAG(2007) FROM RDB$DATABASE; SELECT NULL AS ISCORRECT, F_GRUENDONNERSTAG(NULL) FROM RDB$DATABASE; |
||
![]() ![]() |
||
F_KARFREITAG | function
from adhoc |
|
Entrypoint | karfreitag | compatible with UTF-8 |
Input | INTEGER | year |
Output | DATE | date of Easter Friday of the year |
TestSQL SELECT '06.04.2007' AS ISCORRECT, F_KARFREITAG(2007) FROM RDB$DATABASE; SELECT NULL AS ISCORRECT, F_KARFREITAG(NULL) FROM RDB$DATABASE; |
||
![]() ![]() |
||
F_OSTERSAMSTAG | function
from adhoc |
|
Entrypoint | ostersamstag | compatible with UTF-8 |
Input | INTEGER | year |
Output | DATE | date of Easter Saturday of the year |
TestSQL SELECT '07.04.2007' AS ISCORRECT, F_OSTERSAMSTAG(2007) FROM RDB$DATABASE; SELECT NULL AS ISCORRECT, F_OSTERSAMSTAG(NULL) FROM RDB$DATABASE; |
||
![]() ![]() |
||
F_OSTERDATUM | compatibility to FreeUDFLib AvERP, GrUDF | |
Entrypoint | osterdatum | compatible with UTF-8 |
Input | INTEGER | year |
Output | DATE | date of Easter Sunday of the year |
TestSQL SELECT '27.03.2005' AS ISCORRECT, F_OSTERDATUM(2005) FROM RDB$DATABASE; SELECT NULL AS ISCORRECT, F_OSTERDATUM(NULL) FROM RDB$DATABASE; |
||
![]() ![]() |
||
F_OSTERMONTAG | function
from adhoc |
|
Entrypoint | ostermontag | compatible with UTF-8 |
Input | INTEGER | year |
Output | DATE | date of Easter Monday of the year |
TestSQL SELECT '09.04.2007' AS ISCORRECT, F_OSTERMONTAG(2007) FROM RDB$DATABASE; SELECT NULL AS ISCORRECT, F_OSTERMONTAG(NULL) FROM RDB$DATABASE; |
||
![]() ![]() |
||
F_HIMMELFAHRT | function
from adhoc |
|
Entrypoint | himmelfahrt | compatible with UTF-8 |
Input | INTEGER | year |
Output | DATE | date of Ascension of Chris of the year |
TestSQL SELECT '17.05.2007' AS ISCORRECT, F_HIMMELFAHRT(2007) FROM RDB$DATABASE; SELECT NULL AS ISCORRECT, F_HIMMELFAHRT(NULL) FROM RDB$DATABASE; |
||
![]() ![]() |
||
F_PFINGSTSONNTAG | function
from adhoc |
|
Entrypoint | pfingstsonntag | compatible with UTF-8 |
Input | INTEGER | year |
Output | DATE | date of Whitsunday of the year |
TestSQL SELECT '27.05.2007' AS ISCORRECT, F_PFINGSTSONNTAG(2007) FROM RDB$DATABASE; SELECT NULL AS ISCORRECT, F_PFINGSTSONNTAG(NULL) FROM RDB$DATABASE; |
||
![]() ![]() |
||
F_PFINGSTMONTAG | function
from adhoc |
|
Entrypoint | pfingstmontag | compatible with UTF-8 |
Input | INTEGER | year |
Output | DATE | date of Whitmonday of the year |
TestSQL SELECT '28.05.2007' AS ISCORRECT, F_PFINGSTMONTAG(2007) FROM RDB$DATABASE; SELECT NULL AS ISCORRECT, F_PFINGSTMONTAG(NULL) FROM RDB$DATABASE; |
||
![]() ![]() |
||
F_FRONLEICHNAM | function
from adhoc |
|
Entrypoint | fronleichnam | compatible with UTF-8 |
Input | INTEGER | year |
Output | DATE | date of Feast of Corpus Christi of the year |
TestSQL SELECT '07.06.2007' AS ISCORRECT, F_FRONLEICHNAM(2007) FROM RDB$DATABASE; SELECT NULL AS ISCORRECT, F_FRONLEICHNAM(NULL) FROM RDB$DATABASE; |
||
![]() ![]() ![]() ![]() ![]() |