Welcome Guest, Not a member yet? Register   Sign In
Format Date?
#7

[eluser]xwero[/eluser]
This is the mysql_to_unix function
Code:
function mysql_to_unix($time = '')
    {
        // We'll remove certain characters for backward compatibility
        // since the formatting changed with MySQL 4.1
        // YYYY-MM-DD HH:MM:SS
    
        $time = str_replace('-', '', $time);
        $time = str_replace(':', '', $time);
        $time = str_replace(' ', '', $time);
    
        // YYYYMMDDHHMMSS
        return  mktime(
                        substr($time, 8, 2),
                        substr($time, 10, 2),
                        substr($time, 12, 2),
                        substr($time, 4, 2),
                        substr($time, 6, 2),
                        substr($time, 0, 4)
                        );
    }
The strtotime function is faster because it's a native php function.


Messages In This Thread
Format Date? - by El Forum - 03-10-2008, 05:03 AM
Format Date? - by El Forum - 03-10-2008, 05:41 AM
Format Date? - by El Forum - 03-10-2008, 06:08 AM
Format Date? - by El Forum - 03-10-2008, 06:25 AM
Format Date? - by El Forum - 03-10-2008, 06:38 AM
Format Date? - by El Forum - 03-10-2008, 08:39 AM
Format Date? - by El Forum - 03-10-2008, 08:42 AM
Format Date? - by El Forum - 03-10-2008, 09:22 AM
Format Date? - by El Forum - 03-10-2008, 02:46 PM



Theme © iAndrew 2016 - Forum software by © MyBB