current_time [ WordPress Function ]
| Parameters: |
|
| Returns: |
|
| Defined at: |
|
Retrieve the current time based on specified type.
The 'mysql' type will return the time in the format for MySQL DATETIME field. The 'timestamp' type will return the current timestamp.
If $gmt is set to either '1' or 'true', then both types will use GMT time. if $gmt is false, the output is adjusted with the GMT offset in the WordPress option.
Source
<?php
function current_time( $type, $gmt = 0 ) {
switch ( $type ) {
case 'mysql':
return ( $gmt ) ? gmdate( 'Y-m-d H:i:s' ) : gmdate( 'Y-m-d H:i:s', ( time() + ( get_option( 'gmt_offset' ) * 3600 ) ) );
break;
case 'timestamp':
return ( $gmt ) ? time() : time() + ( get_option( 'gmt_offset' ) * 3600 );
break;
}
}
?>
Examples [ wp-snippets.com ]
Top Google Search Results
- Function Reference/current time « WordPress Codex
Aug 5, 2005 ... Contrary to the struck-out statements below, current_time() does indeed return the proper times regardless of the PHP server's date.timezone ...
codex.wordpress.org - Standard Global Variables — ExpressionEngine 2.5.0 documentation
Apr 5, 2012 ... Note: Unlike the rest of the Standard Global Variables, {current_time} is parsed very early on in the Template parser, which allows you to make ...
expressionengine.com - mysql - Basic SQL CURRENT_TIME() query - Stack Overflow
I have a table with a column having date & time. I have to get all the ... CURRENT_TIME() returns only the time, not the date and time. Returns the ...
stackoverflow.com - CURRENT_TIME function
Nov 10, 2011 ... CURRENT_TIME function. The CURRENT_TIME datetime function returns the current local time. Syntax. Syntax diagram format. Railroad ...
publib.boulder.ibm.com
User discussions [ wordpress.org ]
- Fill in the Blank on "Post Date"
- Fill in the Blank on "Post Date"
- ezs1 on "Post Date"
- ezs1 on "Post Date"
- MichaelH on "display current date in ('F j, Y')"
- homienick on "display current date in ('F j, Y')"
- Ivovic on "display current date in ('F j, Y')"
- homienick on "display current date in ('F j, Y')"
- marky on "current_time()"
- marky on "current_time()"