---
title: "monthPattern"
type: "property"
lastmod: "2026-08-27"
---
## API Reference

> Source set: Android

```kotlin
val monthPattern =
        remember(locale) {
            val yearPattern = DateFormat.getBestDateTimePattern(locale, "y")
            // REVISED, SAFER HEURISTIC:
            // Check if the pattern contains any letter that isn't 'y'. This correctly
            // identifies linguistic markers like '年', '년', 'г', etc., while safely
            // ignoring spaces or simple punctuation.
            val useNumericMonth = yearPattern.any { it.isLetter() && it != 'y' }

            if (useNumericMonth) {
                "MM"
            } else {
                "MMM"
            }
        }
```
