ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:reference:connection:dbdate

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
v5:reference:connection:dbdate [2016/01/17 00:16] – ↷ Page moved from v5:reference:dbdate to v5:reference:connection:dbdate mnewnhamv5:reference:connection:dbdate [2025/07/11 03:22] (current) mnewnham
Line 3: Line 3:
 <WRAP right box> <WRAP right box>
 == syntax == == syntax ==
-  string dbDate(){ +  string dbDate( 
-         float $timestamp +      string|float|object $timestamp, 
-         }+      optional bool $isFieldValue = false 
 +        )
                    
 </WRAP> </WRAP>
 ===== Description ===== ===== Description =====
-The function ''dbDate()'' accepts a Unix Timestamp value, and returns a database-specific date string. This can then be used in SQL statements. The returned value differs from one database to another.+The function ''dbDate()'' accepts a either a Unix timestamp value or a PHP [[https://www.php.net/manual/en/class.datetime.php|DateTime Object]], and returns a database-specific date string. This can then be used in SQL statements. The returned value differs from one database to another.
  
 Note that the returned value already includes any required quoting Note that the returned value already includes any required quoting
 +
 +If the passed value is empty, the the string **null** is returned.
 +
 +If the optional argument //**$isFieldValue**// is true, then the passed value is returned unmodified
 +
 +
  
 ===== Usage ===== ===== Usage =====
v5/reference/connection/dbdate.1452986180.txt.gz · Last modified: (external edit)