djekl
4/22/2013 - 9:58 AM

convert UK date to US date

convert UK date to US date

<?php

    /**
     * private uk2usa()
     * @param  string $timestamp    UK Date Format       (d/m/Y)
     * @return string               American Date Format (Y-m-d)
     */
    private function uk2usa($timestamp = FALSE)
    {
        if( ! $timestamp)
            return date('Y-m-d');

        list($day, $month, $year) = explode('/', $timestamp);
        return $year . '-' . $month . '-' . $day;
    }
    // ------------------------------------------------------------------------