You can do that by following below.
1) Create one block class in your extension or you can use existing block class of your extension.
app/code/Vendor/Magento/MyBlock.php
2) Define your function in Block class to load a order collection.
<?php
namespace Vendor\Magento\Block;
use Magento\Sales\Model\ResourceModel\Order\CollectionFactory as OrderCollectionFactory;
class MyBlock extends \Magento\Framework\View\Element\Template
{
protected $_orderCollectionFactory;
public function __construct(
\Magento\Framework\View\Element\Template\Context $context
OrderCollectionFactory $orderCollectionFactory
)
{
$this->_orderCollectionFactory = $orderCollectionFactory;
parent::__construct($context);
}
public function getOrderCountByDateCollection($startDate, $endDate)
{
return $this->_orderCollectionFactory->create()->addAttributeToFilter('created_at', array('from'=>$startDate, 'to'=>$endDate));
}
}
3)Create one phtml file in your extension (Vendor/Module/view/frontend/templates/order_count.phtml) and Bind your PHTML file with the this block class.
<referenceContainer name="content">
<block class="Vendor\Magento\Block\MyBlock" name="show_count_order" template="Vendor_Magento::order_count.phtml" />
</referenceContainer>
4) Call block function in your PHTML file.
<?php
$startDate = date("Y-m-d h:i:s",strtotime('2022-1-1')); // YOU CAN PASS DATE HERE AS PER YOUR REQUIREMENT
$endDate = date("Y-m-d h:i:s", strtotime('2022-1-30 23:59:00')); // YOU CAN PASS DATE HERE AS PER YOUR REQUIREMENT
$orderCollection = $block->getOrderCountByDateCollection($startDate, $endDate);
?>
<?php if(!empty($orderCollection) && count($orderCollection) > 0) : ?>
<div>
<span><?= __('Order Count:- ') ?></span>
<span><?= count($orderCollection) ?></span>
</div>
<?php endif; ?>
I hope it's will helpful for your requirement.