Using wp_date() to determine date

[ad_1]

Hi,

Can I use wp_date() in a script to determine a certain day in the site’s timezone, or should I not use the function this way?

For example, I use this to determine which day it is:

$today = current_datetime()->getTimestamp();
$day = wp_date('w', $today);
if ($day == '0') {
  echo 'It's sunday';
}

Guess it’s improper use, but just curious how you think about this..

Guido

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer