- 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_getdate

# adodb_getdate

##### See Also

PHP Function getdate()

##### Syntax

    int adodb_getdate(
       optional mixed $timestamp=time()
    )

## Description

Returns an array containing date information, the same as the PHP function `getDate()`, but supporting dates less than 1901 and greater than 2038. The local date/time format is derived from a heuristic the first time adodb_getdate() is called.

## Usage

    /*
    * Gets information from now
    */

    $d = adodb_getdate();

    print_r($d);

    /*
    * Returns
    Array
    (
        [seconds] => 28
        [minutes] => 51
        [hours] => 14
        [mday] => 3
        [wday] => 4
        [mon] => 12
        [year] => 2015
        [yday] => 336
        [weekday] => Thursday
        [month] => December
        [0] => 1449179488
    )
    */

    /*
    * What happened a thousand years ago?
    */
    $d = adodb_getdate(time() - (365 * 24 * 60 * 60 * 1000));
    /*
    * Returns
    Array
    (
        [seconds] => 46
        [minutes] => 54
        [hours] => 14
        [mday] => 27
        [wday] => 2
        [mon] => 7
        [year] => 1016
        [yday] => 208
        [weekday] => Tuesday
        [month] => July
        [0] => -30086820314
    )
    */

Note that in the example above, the number of seconds in array index 0, is negative. This is because we are setting a date prior to the epoch value of 0 at 01/01/1970.

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

### Page Tools

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