Welcome to the dbFunctions.js JavaScript library. This library provides a set of functions that bring SQL-like functionality to JavaScript, making it easier to handle dates, strings, and other types directly in your web projects.
Documentation
To interactively try all the functions and see documentation - visit DbFunctions Documentation and Playground
Each function in the dbFunctions.js library comes with a detailed description, parameter list, and examples.
How to Include the Library
To use dbFunctions.js in your project, include the following script tag in the head of your HTML documents. Preferable, download the file and reference locally.
<script src="https://www.ddginc-usa.com/js/dbFunctions.js"></script>
Sample Function Calls
Here are a few examples of how you can call functions from the dbFunctions.js library:
// Example: Adding days to a date
let newDate = dbf.add_days(new Date(), 10);
// Example: Getting the age difference
let age = dbf.age('1999-01-01', '2020-02-22');
// Example: Formatting a date to MM/DD/YYYY
let fmtDate = dbf.to_char(new Date(),'MM/DD/YYYY');
| Function | Category |
|---|---|
| add_days | Date |
| add_months | Date |
| age | Other |
| ascii | String |
| charindex | String |
| choose | Other |
| chr | String |
| coalesce | Other |
| concat | String |
| curdate | Date |
| curtime | Date |
| current_date | Date |
| current_time | Date |
| current_timezone | Date |
| date_add | Date |
| date_format | Date |
| date_part | Date |
| date_trunc | Date |
| dateadd | Date |
| datediff | Date |
| datename | Date |
| datepart | Date |
| day | Date |
| dayname | Date |
| dayofmonth | Date |
| dayofweek | Date |
| dayofyear | Date |
| defaultdateformat | Date |
| eomonth | Date |
| field | Other |
| format | Date |
| getDaysInMonth | Date |
| getJulianDayNumber | Date |
| getdate | Date |
| greatest | Other |
| hex | Other |
| iif | Other |
| initcap | String |
| instr | String |
| isdate | Date |
| isleapyear | Date |
| isnumeric | Other |
| julianday | Date |
| last_day | Date |
| lcase | String |
| left | String |
| least | Other |
| like | String |
| lower | String |
| lpad | String |
| ltrim | String |
| month | Date |
| monthname | Date |
| months_between | Date |
| next_day | Date |
| next_month | Date |
| next_quarter | Date |
| next_week | Date |
| next_year | Date |
| now | Date |
| nullif | Other |
| nvl | Other |
| parse_url | Other |
| patindex | Other |
| previous_day | Date |
| printf | String |
| quote_nullable | String |
| quotename | String |
| repeat | String |
| replicate | String |
| reverse | String |
| right | String |
| round | Numeric |
| rpad | String |
| rtrim | String |
| soundex | String |
| space | String |
| str | String |
| str_to_date | Date |
| strftime | Date |
| string_agg | String |
| string_escape | String |
| stuff | String |
| substr | String |
| sysdate | Date |
| this_month | Date |
| this_quarter | Date |
| this_week | Date |
| this_year | Date |
| time_slice | Date |
| to_char | String |
| to_date | Date |
| to_hex | Other |
| to_number | Numeric |
| to_roman | String |
| today | Date |
| translate | String |
| translate_format | String |
| trim | String |
| trunc | Numeric |
| ucase | String |
| unhex | Other |
| unistr | String |
| unixepoch | Date |
| unix_timestamp | Date |
| upper | String |
| year | Date |