Methods
date.getDay()
Retrieve the numeric day of the week index from zero for Sunday through six for Saturday.
The getDay method returns an integer representing the day of the week for the current NepaliDate instance. The return value ranges from 0 for Sunday to 6 for Saturday, aligning with standard JavaScript date conventions.
Import
import { NepaliDate } from "nepali-date-library";Signature
getDay(): number;Parameters
- None.
Return Value
- Type:
number - Range:
0to6
| Index | Weekday (English) | Weekday (Devanagari) |
|---|---|---|
0 | Sunday | आइतबार |
1 | Monday | सोमबार |
2 | Tuesday | मङ्गलबार |
3 | Wednesday | बुधबार |
4 | Thursday | बिहिबार |
5 | Friday | शुक्रबार |
6 | Saturday | शनिबार |
Example
import { NepaliDate } from "nepali-date-library";
// 2081 Kartik 15 fell on a Friday
const date = new NepaliDate("2081-07-15");
console.log(date.getDay()); // 5Related
NepaliDate.getDayName(): Retrieve the weekday string name.date.getDate(): Retrieve the day of the month (1–32).
Advertisement
date.getDate()
Retrieve the numeric day of the month from a NepaliDate instance.
date.getHours()
Retrieve the hour component from zero to twenty three for the current date instance.