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/07/12 03:38] – mnewnham | v5:reference:connection:offsetdate [2025/08/23 18:21] (current) – Move note into an Info wrap dregad | ||
---|---|---|---|
Line 3: | Line 3: | ||
<WRAP right box> | <WRAP right box> | ||
== Syntax == | == Syntax == | ||
- | string offsetDate( | + | string|bool ADOConnection:: |
- | string | + | float $offset |
- | | + | |
) | ) | ||
</ | </ | ||
+ | |||
===== Description ===== | ===== Description ===== | ||
- | The function '' | + | The function '' |
+ | |||
+ | The function returns | ||
+ | |||
+ | 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 " | + | |
- | ===== Example ===== | + | |
- | In Oracle, to find the date and time that is 2.5 days from today, you can use: | + | |
- | <code php> | + | |
- | /* | + | |
- | * get date one week from now | + | |
- | */ | + | |
+ | The $isoDate can be: | ||
+ | * A basis date in ISO format including a time portion, if a fractional calculation is required | ||
+ | * An SQL statement that produces an ISO date | ||
+ | * An SQL column if the method is to be used to calculate date offsets based on table values | ||
+ | * skipped or false for today | ||
+ | |||
+ | ===== Examples ===== | ||
+ | |||
+ | Get date one week from now | ||
+ | |||
+ | <code php> | ||
$fld = $conn-> | $fld = $conn-> | ||
/* | /* | ||
* returns " | * returns " | ||
*/ | */ | ||
+ | </ | ||
- | /* | + | Oracle: |
- | | + | |
- | | + | |
- | $fld = $conn-> | + | <code php> |
+ | $fld = $conn-> | ||
/* | /* | ||
| | ||
Line 37: | Line 52: | ||
$conn-> | $conn-> | ||
+ | </ | ||
+ | |||
+ | SQL Server: Get Date -273.5 Hours in the past | ||
+ | |||
+ | <code php> | ||
+ | $fld = $db-> | ||
+ | |||
+ | /* | ||
+ | * Returns " SELECT FORMAT(DATEADD(hour , | ||
+ | */ | ||
+ | </ | ||
+ | |||
+ | 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 " | ||
+ | |||
+ | <code php> | ||
+ | $newDeliveryDate = $db-> | ||
+ | |||
+ | $SQL = " | ||
+ | FROM delivery_master"; | ||
</ | </ | ||
v5/reference/connection/offsetdate.1752284306.txt.gz · Last modified: by mnewnham