NepaliCalendar.Lib
1.0.0
dotnet add package NepaliCalendar.Lib --version 1.0.0
NuGet\Install-Package NepaliCalendar.Lib -Version 1.0.0
<PackageReference Include="NepaliCalendar.Lib" Version="1.0.0" />
<PackageVersion Include="NepaliCalendar.Lib" Version="1.0.0" />
<PackageReference Include="NepaliCalendar.Lib" />
paket add NepaliCalendar.Lib --version 1.0.0
#r "nuget: NepaliCalendar.Lib, 1.0.0"
#:package NepaliCalendar.Lib@1.0.0
#addin nuget:?package=NepaliCalendar.Lib&version=1.0.0
#tool nuget:?package=NepaliCalendar.Lib&version=1.0.0
NepaliCalendar.Lib
A .NET 4.8 library for converting between the Nepali (Bikram Sambat) and Gregorian (AD) calendars.
Features
- Convert AD (Gregorian) to BS (Nepali) date using
AdToBs()
- Convert BS (Nepali) to AD (Gregorian) date using
BsToAd()
- Lightweight and efficient
- Easy to use in your .NET Framework applications
Installation
You can install the package via NuGet by running the following command in the NuGet Package Manager Console:
Install-Package NepaliCalendar.Lib
Or, you can install it via the .NET CLI:
dotnet add package NepaliCalendar.Lib
If you'd like to use it locally before pushing it to NuGet, you can follow these steps to install it from a local package source (for testing):
nuget install NepaliCalendar.Lib -Source "C:\LocalNuGetPackages"
Usage
Convert AD to BS (Nepali Date) using AdToBs
using System;
using NepaliCalendar.Lib;
public class Program
{
public static void Main()
{
DateTime adDate = new DateTime(2025, 4, 17); // Example AD date
string nepaliDate = NepaliCalendarConverter.AdToBs(adDate);
Console.WriteLine($"Nepali Date: {nepaliDate}"); // Example output: 2078/01/04
}
}
Convert BS to AD (Gregorian Date) using BsToAd
using System;
using NepaliCalendar.Lib;
public class Program
{
public static void Main()
{
string bsDate = "2078/01/04"; // Example BS date
DateTime adDate = NepaliCalendarConverter.BsToAd(bsDate);
Console.WriteLine($"Gregorian Date: {adDate.ToShortDateString()}"); // Example output: 2025/04/17
}
}
Examples
- AD to BS: Convert a Gregorian date (
2025/04/17
) to the Nepali date (2078/01/04
) using theAdToBs()
method. - BS to AD: Convert a Nepali date (
2078/01/04
) to the corresponding Gregorian date (2025/04/17
) using theBsToAd()
method.
License
This project is licensed under the MIT License - see the LICENSE.txt file for details.
Contributing
Contributions are welcome! If you'd like to contribute to this project, please fork it, make your changes, and submit a pull request.
Contact
Binod Sapkota
Acknowledgements
- This project was inspired by the need to handle Nepali (Bikram Sambat) date conversion for Nepali users.
- Special thanks to Nepali Date Converter API for the initial algorithm.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net48 is compatible. net481 was computed. |
-
.NETFramework 4.8
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
1.0.0 | 201 | 4/17/2025 |