formating date invoice

This commit is contained in:
Narindra ezway 2025-03-18 10:02:56 +03:00
parent 9fb72d320e
commit 4c911cf4fc

View File

@ -131,13 +131,24 @@ class DateHelpers
}
return $totalHours;
}
public static function convertInvoiceDateToMonthAndYearOnly($invoiceDate = null){
if(!$invoiceDate){
return "";
}
$dateTime = new DateTime($invoiceDate);
$formattedDate = strftime('%B %Y', $dateTime->getTimestamp());
return $formattedDate;
public static function convertInvoiceDateToMonthAndYearOnly($invoiceDate = null)
{
if (!$invoiceDate) {
return "";
}
$dateTime = new DateTime($invoiceDate);
$formatter = new IntlDateFormatter(
'fr_FR',
IntlDateFormatter::LONG,
IntlDateFormatter::NONE,
null,
null,
'MMMM yyyy'
);
return ucfirst($formatter->format($dateTime));
}
}