Skip to content

Instantly share code, notes, and snippets.

@arif98741
Last active November 17, 2022 10:06
Show Gist options
  • Save arif98741/92e3e62f50f5c8e7b3bd43d8c440e6c7 to your computer and use it in GitHub Desktop.
Save arif98741/92e3e62f50f5c8e7b3bd43d8c440e6c7 to your computer and use it in GitHub Desktop.
This is a file of r & d for starting date of current quarter, ending date of current quarter , starting date of previous quarter , ending date of previous quarter.
<?php
echo "start of current quarter date: ";
$startofQuarter = Carbon::now()->startOfQuarter();
echo $startofQuarter;
echo "\n";
echo "end of current quarter date: ";
$startofQuarter = Carbon::now()->endOfQuarter();
echo $startofQuarter;
echo "\n";
echo "previous quarter starting date: ";
$previousQuarter = Carbon::now()->startOfQuarter()->subMonths(3)->format('Y-m-d');
echo $previousQuarter;
echo "\n";
echo "previous quarter ending date: ";
$previousQuarter = Carbon::make($previousQuarter)->endOfQuarter()->format('Y-m-d');
echo $previousQuarter;
echo "\n";
exit;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment