Skip to:
Content

BuddyPress.org

Changeset 2451


Ignore:
Timestamp:
01/25/2010 03:58:46 PM (12 years ago)
Author:
apeatling
Message:

There's nothing I like better than spending an afternoon weaving my way around inconsistencies between PHP4 and PHP5 date/time handling. Fixes #1641

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core.php

    r2440 r2451  
    13651365    );
    13661366
    1367     if ( !is_numeric( $older_date ) )
    1368         $older_date = strtotime( $older_date . ' GMT' );
     1367    if ( !is_numeric( $older_date ) ) {
     1368        $time_chunks = explode( ':', str_replace( ' ', ':', $older_date ) );
     1369        $date_chunks = explode( '-', str_replace( ' ', '-', $older_date ) );
     1370
     1371        $older_date = gmmktime( (int)$time_chunks[1], (int)$time_chunks[2], (int)$time_chunks[3], (int)$date_chunks[1], (int)$date_chunks[2], (int)$date_chunks[0] );
     1372    }
    13691373
    13701374    /* $newer_date will equal false if we want to know the time elapsed between a date and the current time */
    13711375    /* $newer_date will have a value if we want to work out time elapsed between two known dates */
    1372     $newer_date = ( !$newer_date ) ? gmmktime() : $newer_date;
     1376    $newer_date = ( !$newer_date ) ? gmmktime( gmdate( 'H' ), gmdate( 'i' ), gmdate( 's' ), gmdate( 'n' ), gmdate( 'j' ), gmdate( 'Y' ) ) : $newer_date;
    13731377
    13741378    /* Difference in seconds */
Note: See TracChangeset for help on using the changeset viewer.