PeymanMajdii.HijriPersianCalender
1.0.0
dotnet add package PeymanMajdii.HijriPersianCalender --version 1.0.0
NuGet\Install-Package PeymanMajdii.HijriPersianCalender -Version 1.0.0
<PackageReference Include="PeymanMajdii.HijriPersianCalender" Version="1.0.0" />
paket add PeymanMajdii.HijriPersianCalender --version 1.0.0
#r "nuget: PeymanMajdii.HijriPersianCalender, 1.0.0"
// Install PeymanMajdii.HijriPersianCalender as a Cake Addin #addin nuget:?package=PeymanMajdii.HijriPersianCalender&version=1.0.0 // Install PeymanMajdii.HijriPersianCalender as a Cake Tool #tool nuget:?package=PeymanMajdii.HijriPersianCalender&version=1.0.0
Hijri Persian Calender Initializer
Every usage of DateTime becomes to Hijri simply by initializing the culture
Culture_Hijri
Initilize persian culture means every usage of DateTime becomes to Hijri and there is no any concern and extra job needed.
Simply print datetime in Hijri by DateTime.Now
or in SQL Server Transactions.
Persian Calender as default date/time culture.
Convert every use of DateTime to Persion Culture Even SQL Server Transactions
Persian Hint: تبدیل کلیه تاریخ ها به هجری شمسی با یکبار فراخوانی اولیه این فایل
How it works
ASP.Net Core & ASP.Net 5+
Solution Explorer > Startup.cs
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
....
Cultures.InitializePersianCulture(); // <----------------+ add these lines
app.UseRequestLocalization(); // <----+
...
}
ASP.Net MVC Projects
Solution Explorer > Global.asax.cs
protected void Application_Start()
{
...
Cultures.InitializePersianCulture(); // <----------------- add this line
...
}
C# Console Projects
Solution Explorer > Program.cs
private static void Main()
{
...
Cultures.InitializePersianCulture(); // <------------------ add this line
...
}
Usage
Print the current date
var today = DateTime.Now;
Console.WriteLine(today.ToLongDateString()); // 1400 شهریور 27, شنبه
var year = today.Year; // =1400
Sql Server Queris
var today_books = _context.Books.Where(p=>p.RegisterDate.Date == DateTime.Now.Date); // fetch books registered today
foreach(var book in books)
print(book.RegisterDate); // 1400 شهریور 27, شنبه
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net5.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 | 724 | 9/18/2021 |