How to calculate the sum of values of records for the current day and current month?

Hello. Earlier there was a question: "How to calculate the sum of the values of the last 5 records?" the answer to that is successfully found, using . Here is the working code:
<?php
$id = 2743; // ID of the given column
$n = 5; // number of entries to list
$recent = new WP_Query("cat=$id&showposts=$n");
$sum = 0;

while($recent--->have_posts()) {

$recent->the_post();

 if( get_field("result") === 'Win') {
 $value = (float)get_field('koff') * (float)get_field('summa');
 $sum += $value;
 $out = sprintf( '%01.2 f', $value); // 1.23
 } elseif( get_field("result") === 'open') {
 $out = "..."; // ellipsis
 } else {
 $out = '0.00';
}
}
printf( "<p>Sum is: %01.2 f have.e.</p>", $sum);
?>


From the above code it is seen that, depending on conditions (win or not win.) is the work, then these results are added together. And this is happening for last 5 records category 2743.

Now the challenge is to obtain the sum of the values of the entries of the specified category for the current day and current month. I would be grateful for any help specialists.
June 14th 19 at 21:07
1 answer
June 14th 19 at 21:09
The question is how to get the posts in the last day or month? Do I understand correctly? Then see how to add WP_Query to the selection by date https://wp-kama.ru/function/wp_query#parametry-dat...

Find more questions by tags PHPWordPress