formatEnglishDate
fun formatEnglishDate(year: Int, month: Int, dayOfMonth: Int, dayOfWeek: Int, locale: NepaliDateLocale): String(source)
Formats a English date based on the specified user preferences.
Return
A string representing the formatted date according to the user's preferences.
The function supports the following date format styles:
FULL: Monday, March 21, 2024
LONG: March 21, 2024
MEDIUM: 2024 March 21
SHORT_MDY: 06/21/2024
SHORT_YMD: 2024/06/21
COMPACT_MDY: 06/21/24
COMPACT_YMD: 24/06/21
The function uses the specified weekday and month name formats to match the user's preferred format style.
Example usage:
val englishDate = CustomCalendar(year = 2024, month = 3, dayOfMonth = 11, dayOfWeek = 2, ....)
val locale = NepaliDateLocale(
language = NepaliDatePickerLang.ENGLISH, // This is dummy, no need to pass for this case.
dateFormat = NepaliDateFormatStyle.FULL,
weekDayName = NameFormat.FULL,
monthName = NameFormat.FULL
)
val formattedDate = formatEnglishDate(englishDate, locale)
// formattedDate: "Monday, March 11, 2024"Content copied to clipboard
Parameters
year
takes an integer value of year.
month
takes an integer value of month.
dayOfMonth
takes an integer value of day.
dayOfWeek
takes an integer value of day of week.
locale
The NepaliDateLocale specifying the user's preferred date format, weekday name format, language, and month name format.