Skip to content
Advertisement

How to replace YEAR and MONTH to the current figure?

The function is to display a randon image from the folder 2021/01 Since the time is changing every month, how to change it in the first line? To make 2021/01 display the current year and month? For example, next month it will change to <?php $randomdir = dir(‘wp-content/uploads/2021/02’);

JavaScript

Advertisement

Answer

Use date function for the same.

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement