Categories
Apply to

WordPress Time

echo "current_time( 'mysql' ) returns local site time: " . current_time( 'mysql' ) . ' ';
echo "current_time( 'mysql', 1 ) returns GMT: " . current_time( 'mysql', 1 ) . ' ';
echo "current_time( 'timestamp' ) returns local site time: " . date( 'M j, Y g:i a', current_time( 'timestamp', 0 ) ) . ' ';
echo "current_time( 'timestamp', 1 ) returns GMT: " . date( 'Y-m-d H:i:s', current_time( 'timestamp', 1 ) ) . ' ';

Yields

current_time( ‘mysql’ ) returns local site time: 2017-10-06 21:48:07
current_time( ‘mysql’, 1 ) returns GMT: 2017-10-07 01:48:07
current_time( ‘timestamp’ ) returns local site time: Oct 6, 2017 9:48 pm
current_time( ‘timestamp’, 1 ) returns GMT: 2017-10-07 01:48:07

Leave a Reply

Your email address will not be published. Required fields are marked *