How to get short month name from date in php?
In this article, we will implement a php get short month name from date.
1. Code:
<?php
function getShortMonthNameFromDate($date){
$monthName = date('M', strtotime($date));
return $monthName;
}
$date = "2021-02-02";
echo getShortMonthNameFromDate($date);
?>
2. Example:
Input:
date: 2021-02-02
Output:
Feb