- skip to content

# Database Abstraction Layer

### User Tools

- Login

### Site Tools

- Recent changes
- Media Manager
- Sitemap

### Sidebar

##### Resources

- Reference Manual
- User Guide
- The Data Dictionary
- ADOdb-xmlschema
- ADOdb Active Record
- Performance Monitoring
- Date/Time Library
- Session Management Library
- Unsupported Addons
- Coding Standards

##### Supported Databases

- Access
- ADO
- CSV
- Firebird
- Frontbase
- IBM DB2
- Informix
- Interbase
- LDAP
- Microsoft SQL Server
- MySQL
- Netezza
- ODBC
- ODBTP
- Oracle
- PDO
- Postgresql
- SAP ADS
- SAP ASE
- SAP Maxdb
- SAP Sqlanywhere
- Sqlite
- Sybase
- Plain Text
- Visual Foxpro

##### Other

- Feature Comparison Matrix
- Connection Matrix
- Include File Guide

v5:datetime:adodb_date2

# adodb_date2

##### See Also

adodb_date()

##### Syntax

    string adodb_date2(
         string $format,
         optional string $isoDateString = ''
    )

## Description

This function extends the adodb_date() function, allowing the second argument to be passed as an ISO format string instead of a timestamp. This makes it easier to generate formatted times outside of the normal unix timestamp range.

## Usage

    $d = adodb_date2('d-M-Y H:i','1520-12-25 13:01:34');

## Note

To make the calculation work correctly for early years, it is important to use 4 digit years for the `$isoDateString`

    /*
    * Correct usage
    */
    $date = adodb_date('m/d/Y', '0900-12-31 13:01:34')
    /*
    * Returns 12/25/900
    */

    /*
    * Incorrect usage
    */
    $date = adodb_date('m/d/Y', '900-12-31 13:01:34')
    /*
    * Returns 12/03/2015 (todays date)
    */

v5/datetime/adodb_date2.txt · Last modified: 2016/01/12 17:12 by mnewnham

### Page Tools

- Show pagesource
- Old revisions
- Backlinks
- Rename Page
- Back to top