PersianDate 2.1.8

There is a newer version of this package available.
See the version list below for details.
dotnet add package PersianDate --version 2.1.8
NuGet\Install-Package PersianDate -Version 2.1.8
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="PersianDate" Version="2.1.8" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add PersianDate --version 2.1.8
#r "nuget: PersianDate, 2.1.8"
#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.
// Install PersianDate as a Cake Addin
#addin nuget:?package=PersianDate&version=2.1.8

// Install PersianDate as a Cake Tool
#tool nuget:?package=PersianDate&version=2.1.8

Sample 1 line usages:
using PersianDate;

string dts=ConvertDate.ToFa(DateTime.Now);//1393/08/01

//date only (short and D for Long)
dts=ConvertDate.ToFa(DateTime.Now, "d");//93/08/01
dts=ConvertDate.ToFa(DateTime.Now, "D");//پنج شنبه, 01 آبان 1393

//time only
dts=ConvertDate.ToFa(DateTime.Now, "t");//21:53
dts=ConvertDate.ToFa(DateTime.Now, "T");//21:53:26

//general short date + time
dts=ConvertDate.ToFa(DateTime.Now, "g");//93/08/01 21:53
dts=ConvertDate.ToFa(DateTime.Now, "G");//93/08/01 21:53:26

//general full date + time
dts=ConvertDate.ToFa(DateTime.Now, "f");//پنج شنبه, 01 آبان 1393 21:53
dts=ConvertDate.ToFa(DateTime.Now, "F");//پنج شنبه, 01 آبان 1393 21:53:26

//only month and year
dts=ConvertDate.ToFa(DateTime.Now, "m");//آبان 1
dts=ConvertDate.ToFa(DateTime.Now, "y");//1393 آبان

//new standard formats
string string2=ConvertDate.ToFa(DateTime.Now, "yy MMM");//93 آبان
string2=ConvertDate.ToFa(DateTime.Now, "yyyy/MM/dd ");//1393/8/9
string2=ConvertDate.ToFa(DateTime.Now, "yy-M-d ");//93-8-09
string2= ConvertDate.ToFa(DateTime.Now, "ddd dd MMM yyyy");//جمعه 9 آبان 1393

//testing convert back to DateTime from persian string
Datetime d1=ConvertDate.ToEn("1393/08/01");//2014/10/23 00:00:00
d1=ConvertDate.ToEn("01/8/1393");//2014/10/23 00:00:00
d1=ConvertDate.ToEn("1/8/1393");//2014/10/23 00:00:00
d1=ConvertDate.ToEn("1-8-93");//2014/10/23 00:00:00
d1=ConvertDate.ToEn("93-8-01");//2014/10/23 00:00:00
d1=ConvertDate.ToEn("93 8 01");//2014/10/23 00:00:00

//extra spaces and different separators are handled
d1=ConvertDate.ToEn("1_8_1393 ");//2014/10/23 00:00:00
d1=ConvertDate.ToEn(" 1_8_1393 ");//2014/10/23 00:00:00
d1=ConvertDate.ToEn(" 1.8.1393 ");//2014/10/23 00:00:00

Product Compatible and additional computed target framework versions.
.NET net6.0-android was computed.  net7.0-android was computed.  net8.0-android was computed. 
.NET Framework net20 is compatible.  net35 is compatible.  net35-client is compatible.  net40 is compatible.  net403 was computed.  net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid is compatible. 
Silverlight sl2 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 2.0

    • No dependencies.
  • .NETFramework 3.5

    • No dependencies.
  • .NETFramework 4.0

    • No dependencies.
  • .NETFramework 4.5

    • No dependencies.
  • Portable Class Library (.NETFramework 4.0, Silverlight 5.0, Windows 8.0, WindowsPhone 8.0, WindowsPhoneApp 8.1)

    • No dependencies.
  • Portable Class Library (.NETFramework 4.5, Windows 8.0, WindowsPhone 8.0, WindowsPhoneApp 8.1)

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on PersianDate:

Package Downloads

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.5.5 24,741 1/13/2018
3.5.4 1,898 1/12/2018
3.5.3 2,022 12/3/2017
2.1.8 3,402 9/29/2016
1.3.5 4,754 11/2/2014

the time was not correctly converted in all functions when converted from and to dateTime