C# library to convert Nanakshahi date to and from Gregorian date. This library makes it easy to work with Nanakshahi dates.
- Usage
- API
- Constructors
- NanakshahiDateTime(year, month, day)
- NanakshahiDateTime(year, month, day, hour, minute, second)
- NanakshahiDateTime(year, month, day, hour, minute, second, millisecond)
- NanakshahiDateTime(year, nsmonth, day)
- NanakshahiDateTime(year, nsmonth, day, hour, minute, second)
- NanakshahiDateTime(year, nsmonth, day, hour, minute, second, millisecond)
- Instance Methods
- Instance Properties
- Static Methods
- Static Properties
- Extension Methods
- Constructors
- License
- Install Nanakshahi package via NuGet.
- Add
using Nanakshahi
- Done!
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);
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);
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);
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);
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);
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);
Turns Nanakshahi DateTime into Gregorian DateTime
Returns: DateTime
- Gregorian DateTime object
Example
new NanakshahiDateTime(533, 4, 31);
Gets the Nanakshahi year component of the date represented by this instance.
Returns: Int
- Nanakshahi year
Example
new NanakshahiDateTime(552, 1, 1).Year;
Gets the Nanakshahi month component of the date represented by this instance.
Returns: NsMonth
- Nanakshahi Object
Example
new NanakshahiDateTime(552, 1, 1).Month;
Gets the Nanakshahi day component of the date represented by this instance.
Returns: Int
- Nanakshahi day
Example
new NanakshahiDateTime(552, 1, 1).Day;
Gets the hour component of the date represented by this instance.
Returns: Int
- Hour
Example
new NanakshahiDateTime(552, 1, 1).Hour;
Gets the minute component of the date represented by this instance.
Returns: Int
- Minute
Example
new NanakshahiDateTime(552, 1, 1).Minute;
Gets the second component of the date represented by this instance.
Returns: Int
- Second
Example
new NanakshahiDateTime(552, 1, 1).Second;
Gets the millisecond component of the date represented by this instance.
Returns: Int
- Millisecond
Example
new NanakshahiDateTime(552, 1, 1).Millisecond;
Gets the day of the Nanakshahi week represented by this instance.
Returns: NsWeek
- NsWeek Object
Example
new NanakshahiDateTime(552, 1, 1).WeekDay;
Gets the day of the Nanakshahi year represented by this instance.
Returns: Int
- Day of Nanakshahi year.
Example
new NanakshahiDateTime(552, 1, 1).DayOfYear;
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);
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);
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;
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;
Turns Gregorian DateTime into Nanakshahi DateTime
Returns: NanakshahiDateTime
- NanakshahiDateTime object
Example
NanakshahiDateTime.Today;
Licensed under the GPL v3.