v5:reference:connection:offsetdate
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
v5:reference:connection:offsetdate [2025/08/20 05:04] – mnewnham | v5:reference:connection:offsetdate [2025/08/23 18:21] (current) – Move note into an Info wrap dregad | ||
---|---|---|---|
Line 4: | Line 4: | ||
== Syntax == | == Syntax == | ||
string|bool ADOConnection:: | string|bool ADOConnection:: | ||
- | string|float $offset | + | float $offset |
| | ||
) | ) | ||
</ | </ | ||
- | |||
- | ==== Note ==== | ||
- | Passing a decimal offset less than one without | ||
- | specifying a base date will always return the | ||
- | current date because the calculation time | ||
- | basis is always the beginning of the current date | ||
===== Description ===== | ===== Description ===== | ||
Line 21: | Line 15: | ||
The function returns false if invalid parameters are provided. | The function returns false if invalid parameters are provided. | ||
+ | |||
+ | <WRAP info> | ||
+ | Passing a decimal offset less than one without | ||
+ | specifying a base date will always return the | ||
+ | current date because the calculation time | ||
+ | basis is always the beginning of the current date | ||
+ | </ | ||
===== Inputs ===== | ===== Inputs ===== | ||
- | The $offset | + | The $offset |
- | * As a decimal indicating | + | |
- | * As string in the format " | + | |
The $isoDate can be: | The $isoDate can be: | ||
Line 33: | Line 32: | ||
* skipped or false for today | * skipped or false for today | ||
- | ===== Example | + | ===== Examples |
- | In Oracle, to find the date and time that is 2.5 days from today, you can use: | + | |
+ | Get date one week from now | ||
<code php> | <code php> | ||
- | /* | ||
- | * get date one week from now | ||
- | */ | ||
- | |||
$fld = $conn-> | $fld = $conn-> | ||
/* | /* | ||
* returns " | * returns " | ||
*/ | */ | ||
+ | </ | ||
- | /*=== | + | Oracle: |
- | | + | |
- | | + | |
- | $fld = $conn-> | + | <code php> |
+ | $fld = $conn-> | ||
/* | /* | ||
| | ||
Line 57: | Line 54: | ||
</ | </ | ||
- | ===== Example Using SQL Server | + | SQL Server: Get Date -273.5 Hours in the past |
<code php> | <code php> | ||
+ | $fld = $db-> | ||
/* | /* | ||
- | * Get Date -273.5 Hours in the past | + | * Returns " SELECT FORMAT(DATEADD(hour , |
- | */ | + | */ |
- | $fld = $db-> | + | |
- | + | ||
- | /* | + | |
- | * Returns " SELECT FORMAT(DATEADD(hour , | + | |
- | */ | + | |
</ | </ | ||
- | ===== Example | + | Generating A Date From a column Value. |
In this example we would use the statement to return a date 7 days forward from the current value of the column " | In this example we would use the statement to return a date 7 days forward from the current value of the column " | ||
<code php> | <code php> | ||
- | + | $newDeliveryDate = $db-> | |
- | $newDeliveryDate = $db-> | + | |
$SQL = " | $SQL = " | ||
- | FROM delivery_master | + | FROM delivery_master" |
- | WHERE delivery_date = {$db-> | + | |
- | | + | |
</ | </ | ||
v5/reference/connection/offsetdate.1755659056.txt.gz · Last modified: by mnewnham