Codex tools: Log in / create account
Contents |
Returns the current time or timestamp. The time returned will be the server time + the offset in the options page, and it will be equivalent to the time displayed on the options page itself.
<?php echo current_time($type, $gmt = 0); ?>
This example gets the current time and assigns the parameters to variables.
<?php
$blogtime = current_time('mysql');
list( $today_year, $today_month, $today_day, $hour, $minute, $second ) = split( '([^0-9])', $blogtime );
?>
Get the current system time in two formats.
<?php echo('Current time: ' . current_time('mysql') . '<br />'); ?>
<?php echo('Current timestamp: ' . current_time('timestamp')); ?>
This article is marked as in need of editing. You can help Codex by editing it.