定制 nutandc/nepali-date-converter 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

nutandc/nepali-date-converter

最新稳定版本:v1.1.3

Composer 安装命令:

composer require nutandc/nepali-date-converter

包简介

Nepali Date Converter (BS <-> AD) for Nepal-first date conversion.

README 文档

README

CI Latest Version Total Downloads License

A lightweight PHP package to convert Nepali Bikram Sambat (BS) dates to Gregorian (AD) and vice versa.

Requirements

  • PHP 8.2+
  • Laravel 10+ (optional, for container binding)

Installation

composer require nutandc/nepali-date-converter

Usage

use Nutandc\NepaliDateConverter\DateConverter;
use Nutandc\NepaliDateConverter\Enums\EnglishDateFormat;
use Nutandc\NepaliDateConverter\Enums\NepaliDateFormat;

$converter = new DateConverter();

// AD to BS
$bs = $converter->toNepali(2020, 10, 4);

$bs->toDateString();
// 2077-06-18

$bs->toFormattedEnglish();
// 18 Ashoj 2077, Sunday

$bs->toFormattedNepali();
// २०७७ असोज १८, आइतवार

$bs->toArray();
// ['year' => 2077, 'month' => 6, 'day' => 18, 'day_of_week' => 1]

$bs->toFormattedArray();
// ['year' => '२०७७', 'month' => 'असोज', 'day' => '१८', 'day_of_week' => 'आइतवार']

// AD to BS using DateTime/Carbon
$bs = $converter->toNepaliFromDateTime(new DateTimeImmutable('2022-09-08'));

// BS to AD
$ad = $converter->toEnglish(2077, 6, 18);

$ad->toDateString();
// 2020-10-04

$ad->toFormattedEnglish();
// October 4, 2020

Helpers

$converter->daysInNepaliMonth(2077, 6); // 30
$converter->daysInEnglishMonth(2020, 2); // 29

Formatting

$bs->format(NepaliDateFormat::DateString); // 2077-06-18
$bs->format(NepaliDateFormat::FormattedNepali); // २०७७ असोज १८, आइतवार

$ad->format(EnglishDateFormat::DateString); // 2020-10-04
$ad->format(EnglishDateFormat::FormattedEnglish); // October 4, 2020

Laravel 10+ Usage

use Nutandc\NepaliDateConverter\DateConverter;

$converter = app(DateConverter::class);
$bs = $converter->toNepali(2020, 10, 4);

Supported Range

  • AD: 1944 - 2033
  • BS: 2000 - 2090

License

MIT

统计信息

  • 总下载量: 2
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 5
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-02

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固