C# Class FarsiLibrary.Utils.PersianDateConverter

Class to convert PersianDate into normal DateTime value and vice versa. PersianDate
You can use FarsiLibrary.Utils.FarsiDate.Now property to access current Date.
Datei anzeigen Open project: HEskandari/FarsiLibrary Class Usage Examples

Public Methods

Method Description
IsJLeapYear ( int jyear ) : bool

Checks if a year is a leap one.

ToGregorianDate ( PersianDate date ) : string

Converts a Persian Date of type String to Gregorian Date of type String.

ToGregorianDateTime ( PersianDate date ) : DateTime
ToGregorianDateTime ( string date ) : DateTime

Converts a Persian Date of type String to Gregorian Date of type DateTime class.

ToPersianDate ( DateTime dt ) : PersianDate

Converts a Gregorian Date of type String class to Persian Date.

ToPersianDate ( string date ) : PersianDate

Converts a Gregorian Date of type System.DateTime class to Persian Date.

ToPersianDate ( string date, TimeSpan time ) : PersianDate

Converts a Gregorian Date of type String and a TimeSpan into a Persian Date.

Private Methods

Method Description
DayOfWeek ( System.DateTime date ) : string

Gets Persian Weekday name from specified Gregorian Date.

DayOfWeek ( PersianDate date ) : string
GLeap ( int gyear ) : int

Checks if a specified Gregorian year is a leap one.

GregDays ( int gYear, int gMonth, int gDay ) : int
JLeap ( int jyear ) : int

Checks if a specified Persian year is a leap one.

JLeapYears ( int jYear ) : int
JalaliDays ( int jYear, int jMonth, int jDay ) : int
MonthDays ( int MonthNo ) : int

Returns number of days in specified month number.

Method Details

IsJLeapYear() public static method

Checks if a year is a leap one.
public static IsJLeapYear ( int jyear ) : bool
jyear int Year to check
return bool

ToGregorianDate() public static method

Converts a Persian Date of type String to Gregorian Date of type String.
public static ToGregorianDate ( PersianDate date ) : string
date PersianDate
return string

ToGregorianDateTime() public static method

public static ToGregorianDateTime ( PersianDate date ) : DateTime
date PersianDate
return DateTime

ToGregorianDateTime() public static method

Converts a Persian Date of type String to Gregorian Date of type DateTime class.
public static ToGregorianDateTime ( string date ) : DateTime
date string Date to evaluate
return DateTime

ToPersianDate() public static method

Converts a Gregorian Date of type String class to Persian Date.
public static ToPersianDate ( DateTime dt ) : PersianDate
dt DateTime Date to evaluate
return PersianDate

ToPersianDate() public static method

Converts a Gregorian Date of type System.DateTime class to Persian Date.
public static ToPersianDate ( string date ) : PersianDate
date string DateTime to evaluate
return PersianDate

ToPersianDate() public static method

Converts a Gregorian Date of type String and a TimeSpan into a Persian Date.
public static ToPersianDate ( string date, TimeSpan time ) : PersianDate
date string
time TimeSpan
return PersianDate