However, I noticed that the datetime returned by current_time( 'Y-m-d H:i:s', true ) is actually different from the local time returned by the current implementation:
/* Current implementation, modified to display datetime instead for this example */
echo gmdate( 'Y-m-d H:i:s', ( time() + ( get_option( 'gmt_offset' ) * 3600 ) ) );
// Displays '2018-10-28 16:54:27', which is the current local time
// as set in Settings > General > Timezone.
/* Your code, also modified to display datetime instead of date */
echo current_time( 'Y-m-d H:i:s', true );
// Displays '2018-10-28 20:57:33', which it's not right.
If we pass 0/false as the second parameter to the current_time() function, we get:
Hi @rilwis,
Thanks for contributing!
However, I noticed that the datetime returned by
current_time( 'Y-m-d H:i:s', true )
is actually different from the local time returned by the current implementation:If we pass
0
/false
as the second parameter to the current_time() function, we get:Now both implementations return the right date (and time) as set in Settings > General > Timezone.
If you can include this change in your PR, I'll merge it right away.
Thanks again for helping out!