ConvertGregorianDateToSolar 1.0.0

dotnet add package ConvertGregorianDateToSolar --version 1.0.0
                    
NuGet\Install-Package ConvertGregorianDateToSolar -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ConvertGregorianDateToSolar" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ConvertGregorianDateToSolar" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="ConvertGregorianDateToSolar" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ConvertGregorianDateToSolar --version 1.0.0
                    
#r "nuget: ConvertGregorianDateToSolar, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=ConvertGregorianDateToSolar&version=1.0.0
                    
Install ConvertGregorianDateToSolar as a Cake Addin
#tool nuget:?package=ConvertGregorianDateToSolar&version=1.0.0
                    
Install ConvertGregorianDateToSolar as a Cake Tool

ConvertGregorianDateToSolar

NuGet License: MIT

A minimal .NET library that converts Gregorian dates to Persian (Shamsi) format using PersianCalendar.
Perfect for applications targeting Iranian users.


✨ Features

  • 🔁 Converts a DateTime value to the Shamsi (Persian) calendar.
  • 📅 Uses System.Globalization.PersianCalendar internally.
  • 💼 Useful for desktop or web applications needing localized date formats.

🚀 How to Use

Install via .NET CLI:

dotnet add package ConvertGregorianDateToSolar

Or via Package Manager:

Install-Package ConvertGregorianDateToSolar

💡 Example

using System;
using ConvertGregorianDateToSolar;

class Program
{
    static void Main(string[] args)
    {
        var converter = new ConvertDate();
        var today = DateTime.Now;
        string shamsi = converter.ToShamsiDate(today);

        Console.WriteLine($"Shamsi Date: {shamsi}");
    }
}

✔️ Sample Output:

Shamsi Date: 1404/1/20

⚙️ Method

public string ToShamsiDate(DateTime date)

Description: Converts the given DateTime to a string in yyyy/MM/dd format based on the Persian calendar.

🛠 Target Framework

.NET 9

📦 NuGet Package

You can get the package from NuGet: https://www.nuget.org/packages/ConvertGregorianDateToSolar/

📄 License

This project is licensed under the MIT License — free for personal and commercial use. See the LICENSE file for more information.

👨‍💻 Author

Created with ❤️ by Hamed Heydarian GitHub: https://github.com/hheydarian

🚧 This project is under active development and will be expanded with more features like:

"Shamsi to Gregorian conversion" "Localized formatting options" "Extended date formatting patterns"

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net9.0

    • 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 151 3/30/2025