How to get the month name from a date in Scala

1 Answer

0 votes
import java.time.LocalDate
import java.time.format.TextStyle
import java.util.Locale

val date = LocalDate.of(2025, 1, 7) 

val monthName = date.getMonth.getDisplayName(TextStyle.FULL, Locale.ENGLISH)

println(monthName)


  
  
/*
run:
    
January
  
*/

 



answered Jan 7, 2025 by avibootz
...