Nepali DateNepali DateBikram Sambat Date Engine
Static Methods

PackagistNepaliDate::getDayName()

Static utility to retrieve the localized English or Nepali name for any day of the week index.

The getDayName static method converts a numeric weekday index from 0 for Sunday through 6 for Saturday into its localized name. It supports both English and Nepali Devanagari script output, allowing flexible localization across international and local application interfaces.


Import

use NepaliDateLibrary\NepaliDate;

Signature

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

Parameters

ParameterTypeRequiredDefaultDescription
$dayintYes-Weekday index from 0 for Sunday to 6 for Saturday.
$shortboolNofalseReturn abbreviated name.
$nepaliboolNofalseReturn name in Devanagari Nepali script.

Return Value

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

Examples

use NepaliDateLibrary\NepaliDate;

// English full name (5 is Friday)
echo NepaliDate::getDayName(5) . PHP_EOL; // "Friday"

// English abbreviation
echo NepaliDate::getDayName(5, true) . PHP_EOL; // "Fri"

// Devanagari full name
echo NepaliDate::getDayName(5, false, true) . PHP_EOL; // "शुक्रबार"

// Devanagari abbreviation
echo NepaliDate::getDayName(5, true, true) . PHP_EOL; // "शु"

Advertisement

On this page