WordPress.org

Ready to get started?Download WordPress

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Difference between revisions of "Function Reference/current time"

(remove new page created)
(Using Parameter template)
Line 22: Line 22:
   
 
== Parameters ==
 
== Parameters ==
+
{{Parameter|$type|string|The time format to return. Possible values:<ul><li><tt>mysql</tt></li><li><tt>timestamp</tt></li></ul>}}
; type : (''string'') Possible values: mysql or timestamp.
 
   
 
[[Category:Functions]]
 
[[Category:Functions]]
 
 
{{Copyedit}}
 
{{Copyedit}}

Revision as of 02:08, 13 January 2008

Description

Returns the current time or timestamp.

Usage

 <?php echo current_time($type$gmt 0); ?> 

Example

Usage

Get the current system time in two formats.

<?php echo('Current time: ' . current_time(mysql) . '<br />'); ?>
<?php echo('Current timestamp: ' . current_time(timestamp)); ?>
Current time: 2005-08-05 10:41:13
Current timestamp: 1123238473

Parameters

$type
(string) (required) The time format to return. Possible values:
  • mysql
  • timestamp
Default: None
This article is marked as in need of editing. You can help Codex by editing it.