|Reported by:||johnbillion||Owned by:||nacin|
WordPress comes with a function called current_time() which returns the current time according to the timezone chosen on the General Settings screen. It's used when populating the post date, among other things.
It would be nice to have a date equivalent of this function for outputting the current date according to the timezone setting. Currently if you want to output the current date you need to do this:
echo date( 'd/m/Y', current_time( 'timestamp' ) );
I'd like to be able to use this instead:
echo current_date( 'd/m/Y' );
Note that just using date() doesn't give the desired effect as WordPress sets the default timezone (as used by date()) to UTC, not to the timezone chosen on the settings screen.
Change History (12)
comment:3 follow-up: ↓ 4 @danielbachhuber — 3 years ago
- Cc danielbachhuber added
- Component changed from General to Date/Time