current_time [ WordPress Functions ]
| Parameters: |
|
| Returns: |
|
| Defined at: |
|
| Codex |
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
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' ) * HOUR_IN_SECONDS ) ) );
break;
case 'timestamp':
return ( $gmt ) ? time() : time() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS );
break;
}
}Examples [ wp-snippets.com ]
Top Google Search Results
- current_time - WordPress Codex
Aug 5, 2005 ... Description. Returns the blog's current local time in one of two formats, either MySQL's timestamp data type format (i.e. YYYY-MM-DD ...
codex.wordpress.org - WordPress › Support » current_time()
I'm trying to write a small plugin to display messages on my site depending on the day. (My site is updated on a very strict schedule, and I want to display when ...
wordpress.org - 12.7 Date and Time Functions - MySQL
The CURRENT_TIMESTAMP() , CURRENT_TIME() , CURRENT_DATE() , and FROM_UNIXTIME() functions return values in the connection's current time zone, ...
dev.mysql.com - current_time (WordPress Function) - WPSeek.com
Jun 9, 2013 ... Retrieve the current time based on specified type. WordPress lookup for current_time, a WordPress Function.
wpseek.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()"
