formatNepaliDate
Formats a Nepali date based on the specified user preferences. (Without date range validation)
Return
A string representing the formatted date according to the user's preferences.
The function supports the following date format styles:
FULL: Monday, Asar 21, 2024 or, सोमबार, असार २१, २०२४
LONG: Asar 21, 2024 or, असार २१, २०२४
MEDIUM: 2024 Asar 21 or, २०२४ असार २१
SHORT_MDY: 06/21/2024 or, ०६/२१/२०२४
SHORT_YMD: 2024/06/21 or, २०२४/०६/२१
COMPACT_MDY: 06/21/24 or, ०६/२१/२४
COMPACT_YMD: 24/06/21 or, २४/०६/२१
The function uses the specified weekday and month name formats to match the preferred language and format style.
Example usage:
val locale = NepaliDateLocale(
language = NepaliDatePickerLang.ENGLISH,
dateFormat = NepaliDateFormatStyle.FULL,
weekDayName = NameFormat.FULL,
monthName = NameFormat.FULL
)
val formattedDate = formatNepaliDate(year = 2080, month = 3, dayOfMonth = 15, dayOfWeek = 2, locale)
// formattedDate: "Tuesday, Asar 15, 2080"Parameters
takes an integer value of year.
takes an integer value of month which takes value between 1 to 12.
takes an integer value of day of month which takes value between 1 to 32.
takes an integer value of day of week which takes value between 1 to 7.
The NepaliDateLocale specifying the user's preferred language,date format, weekday name format, and month name format.
Overload function of above formatNepaliDate function without date range validation.
Formats a Nepali date based on the specified user preferences. (With date validation)
Return
A string representing the formatted date according to the user's preferences.
The function supports the following date format styles:
FULL: Monday, Asar 21, 2024 or, सोमबार, असार २१, २०२४
LONG: Asar 21, 2024 or, असार २१, २०२४
MEDIUM: 2024 Asar 21 or, २०२४ असार २१
SHORT_MDY: 06/21/2024 or, ०६/२१/२०२४
SHORT_YMD: 2024/06/21 or, २०२४/०६/२१
COMPACT_MDY: 06/21/24 or, ०६/२१/२४
COMPACT_YMD: 24/06/21 or, २४/०६/२१
The function uses the specified weekday and month name formats to match the preferred language and format style.
Example usage:
val customCalendar = CustomCalendar(year = 2080, month = 3, dayOfMonth = 15, dayOfWeek = 2, ....)
val locale = NepaliDateLocale(
language = NepaliDatePickerLang.ENGLISH,
dateFormat = NepaliDateFormatStyle.FULL,
weekDayName = NameFormat.FULL,
monthName = NameFormat.FULL
)
val formattedDate = formatNepaliDate(customCalendar, locale)
// formattedDate: "Tuesday, Asar 15, 2080"Parameters
The CustomCalendar containing the year, month, day, and weekday.
The NepaliDateLocale specifying the user's preferred language,date format, weekday name format, and month name format.