Nepali DateNepali DateBikram Sambat Date Engine
Static Methods

PackagistNepaliDate::getMonthName()

Static utility to retrieve the localized English or Nepali month name for any month index.

The getMonthName static method returns the localized name of a Bikram Sambat month given its zero based index from 0 for Baisakh to 11 for Chaitra. It supports full names as well as short abbreviations in both English and Devanagari script.


Import

use NepaliDateLibrary\NepaliDate;

Signature

public static function getMonthName(
    int $month,
    bool $short = false,
    bool $nepali = false
): string;

Parameters

ParameterTypeRequiredDefaultDescription
$monthintYes-Zero based month index from 0 to 11.
$shortboolNofalseReturn abbreviated three letter or short string.
$nepaliboolNofalseReturn name in native Devanagari Nepali script.

Return Value

  • Type: string
  • Description: Localized month name string.

Examples

use NepaliDateLibrary\NepaliDate;

// English full name (Kartik is index 6)
echo NepaliDate::getMonthName(6) . PHP_EOL; // "Kartik"

// English abbreviation
echo NepaliDate::getMonthName(6, true) . PHP_EOL; // "Kar"

// Devanagari full name
echo NepaliDate::getMonthName(6, false, true) . PHP_EOL; // "कार्तिक"

// Devanagari abbreviation
echo NepaliDate::getMonthName(6, true, true) . PHP_EOL; // "का"

Advertisement

On this page