getFormattedTimeInNepali

fun getFormattedTimeInNepali(simpleTime: SimpleTime, use12HourFormat: Boolean = true): String(source)

Formats a SimpleTime object into a Nepali time string.

This function generates a formatted time string in Nepali.

The time of day is determined using hour values to Nepali names:

  • 3-11: "बिहान"

  • 12-16: "दिउँसो"

  • 17-19: "साँझ"

  • Other: "राति"

The hour is displayed in 12-hour format if use12HourFormat is true, otherwise in 24-hour format. Minutes are always displayed with two digits (e.g., 05, 30). Digits are converted to Nepali using the convertToNepaliNumber function.

Return

A formatted time string in Nepali.

val time = SimpleTime(16, 30, 0, 0)
val nepaliTime12Hour = getFormattedTimeInNepali(time) // Output: "दिउँसो ४ : ३०"
val nepaliTime24Hour = getFormattedTimeInNepali(time, false) // Output: "१६ : ३०"

Parameters

simpleTime

The SimpleTime object to format.

use12HourFormat

If true (default), the time will be formatted in 12-hour format including the time of day. If false, the time will be formatted in 24-hour format.