Skip to content

C# library to convert Nanakshahi date to and from Gregorian date. This library makes it easy to work with Nanakshahi dates.

License

Notifications You must be signed in to change notification settings

onkarjit/Nanakshahi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nanakshahi

C# library to convert Nanakshahi date to and from Gregorian date. This library makes it easy to work with Nanakshahi dates.

Contents

Usage

  1. Install Nanakshahi package via NuGet.
  2. Add using Nanakshahi
  3. Done!

API

Constructors

NanakshahiDateTime(year, month, day)

Initializes a new instance of the DateTime to the specified year, month, day

Returns: NanakshahiDateTime - Returns a new instance of the DateTime to the specified year, month, day

Param Type Description
year int Nanakshahi Year, 1-9999
month int Nanakshahi Month, 1-12
day int Nanakshahi Day, 1-31

Example

new NanakshahiDateTime(533, 2, 31);

NanakshahiDateTime(year, month, day, hour, minute, second)

Initializes a new instance of the DateTime to the specified year, month, day, hour, minute, second

Returns: NanakshahiDateTime - Returns a new instance of the DateTime to the specified year, month, day, hour, minute, second

Param Type Description
year int Nanakshahi Year, 1-9999
month int NsMonth enum
day int Nanakshahi Day, 1-31
hour int Hour, 0-23
minute int Minute, 0-59
second int Second, 0-59

Example

new NanakshahiDateTime(533, 2, 31, 2, 30, 5);

NanakshahiDateTime(year, month, day, hour, minute, second, millisecond)

Initializes a new instance of the DateTime to the specified year, month, day, hour, minute, second, millisecond

Returns: NanakshahiDateTime - Returns a new instance of the DateTime to the specified year, month, day, hour, minute, second, millisecond

Param Type Description
year int Nanakshahi Year, 1-9999
month int Nanakshahi Month, 1-12
day int Nanakshahi Day, 1-31
hour int Hour, 0-23
minute int Minute, 0-59
second int Second, 0-59
millisecond double Millisecond, 0-999

Example

new NanakshahiDateTime(533, 2, 31, 2, 30, 5, 10);

NanakshahiDateTime(year, nsmonth, day)

Initializes a new instance of the DateTime to the specified year, month, day

Returns: NanakshahiDateTime - Returns a new instance of the DateTime to the specified year, nsmonth, day

Param Type Description
year int Nanakshahi Year, 1-9999
month NsMonth NsMonth enum
day int Nanakshahi Day, 1-31

Example

new NanakshahiDateTime(533, NsMonth.Vaisakh, 31);

NanakshahiDateTime(year, nsmonth, day, hour, minute, second)

Initializes a new instance of the DateTime to the specified year, nsmonth, day, hour, minute, second

Returns: NanakshahiDateTime - Returns a new instance of the DateTime to the specified year, nsmonth, day, hour, minute, second

Param Type Description
year int Nanakshahi Year, 1-9999
month NsMonth NsMonth enum
day int Nanakshahi Day, 1-31
hour int Hour, 0-23
minute int Minute, 0-59
second int Second, 0-59

Example

new NanakshahiDateTime(533, NsMonth.Vaisakh, 31, 2, 30, 5);

NanakshahiDateTime(year, nsmonth, day, hour, minute, second, millisecond)

Initializes a new instance of the DateTime to the specified year, nsmonth, day, hour, minute, second, millisecond

Returns: NanakshahiDateTime - Returns a new instance of the DateTime to the specified year, nsmonth, day, hour, minute, second, millisecond

Param Type Description
year int Nanakshahi Year, 1-9999
month NsMonth NsMonth enum
day int Nanakshahi Day, 1-31
hour int Hour, 0-23
minute int Minute, 0-59
second int Second, 0-59
millisecond double Millisecond, 0-999

Example

new NanakshahiDateTime(533, NsMonth.Vaisakh, 31, 2, 30, 5, 10);

Instance Methods

ToGregorianDateTime()

Turns Nanakshahi DateTime into Gregorian DateTime

Returns: DateTime - Gregorian DateTime object

Example

new NanakshahiDateTime(533, 4, 31);

Instance Properties

Year

Gets the Nanakshahi year component of the date represented by this instance.

Returns: Int - Nanakshahi year

Example

new NanakshahiDateTime(552, 1, 1).Year;

Month

Gets the Nanakshahi month component of the date represented by this instance.

Returns: NsMonth - Nanakshahi Object

Example

new NanakshahiDateTime(552, 1, 1).Month;

Day

Gets the Nanakshahi day component of the date represented by this instance.

Returns: Int - Nanakshahi day

Example

new NanakshahiDateTime(552, 1, 1).Day;

Hour

Gets the hour component of the date represented by this instance.

Returns: Int - Hour

Example

new NanakshahiDateTime(552, 1, 1).Hour;

Minute

Gets the minute component of the date represented by this instance.

Returns: Int - Minute

Example

new NanakshahiDateTime(552, 1, 1).Minute;

Second

Gets the second component of the date represented by this instance.

Returns: Int - Second

Example

new NanakshahiDateTime(552, 1, 1).Second;

Millisecond

Gets the millisecond component of the date represented by this instance.

Returns: Int - Millisecond

Example

new NanakshahiDateTime(552, 1, 1).Millisecond;

Weekday

Gets the day of the Nanakshahi week represented by this instance.

Returns: NsWeek - NsWeek Object

Example

new NanakshahiDateTime(552, 1, 1).WeekDay;

DayOfYear

Gets the day of the Nanakshahi year represented by this instance.

Returns: Int - Day of Nanakshahi year.

Example

new NanakshahiDateTime(552, 1, 1).DayOfYear;

Static Methods

DaysInMonth(year, month)

Returns the number of days in the specified Nanakshahi month and year.

Returns: int - Number of days in the specified Nanakshahi month and year.

Param Type Description
year int Nanakshahi Year, 1-9999
month int Nanakshahi Year, 1-12

Example

NanakshahiDateTime.DaysInMonth(552, 12);

DaysInMonth(year, nsmonth)

Returns the number of days in the specified nanakshahi month and year.

Returns: int - Number of days in the specified Nanakshahi month and year.

Param Type Description
year int Nanakshahi Year, 1-9999
month NsMonth NsMonth enum

Example

NanakshahiDateTime.DaysInMonth(552, NsMonth.Chet);

Static Properties

Now

Gets a NanakshahiDateTime object that is set to the current date and time on this computer, expressed as the local time.

Returns: NanakshahiDateTime - Return's a NanakshahiDateTime with current date and time.

Example

NanakshahiDateTime.Now;

Today

Gets a NanakshahiDateTime object that is set to today's date, with the time component set to 00:00:00.

Returns: NanakshahiDateTime - Return's a NanakshahiDateTime object with today's date and the time component set to 00:00

Example

NanakshahiDateTime.Today;

Extension Methods

ToNanakshahiDateTime(this DateTime)

Turns Gregorian DateTime into Nanakshahi DateTime

Returns: NanakshahiDateTime - NanakshahiDateTime object

Example

NanakshahiDateTime.Today;

License

Licensed under the GPL v3.

About

C# library to convert Nanakshahi date to and from Gregorian date. This library makes it easy to work with Nanakshahi dates.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages