Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Dates In MySQL And PHP

DZone's Guide to

Dates In MySQL And PHP

·
Free Resource
        // $mysqldate is ready to be inserted into a DB
        // $phpdate is ready to used in a PHP script

        // For use with DATESTAMP type or TIMESTAMP type

        $mysqldate = date( 'Y-m-d H:i:s', $phpdate );

        $phpdate = strtotime( $mysqldate );



        // For use with DATE type

        $mysqldate = date( 'Y-m-d', $phpdate ); // H:i:s will be 00:00:00

        $phpdate = strtotime( $mysqldate );

Topics:

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}