Advertisement
Sketchware

Mostrar nome do mês no EditText

Jun 24th, 2023
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.39 KB | None | 0 0
  1. SimpleDateFormat dateFormat = new SimpleDateFormat("MM");
  2. String monthNumber = dateFormat.format(data_ano.getTime());
  3.  
  4. String[] monthNames = {"", "JANEIRO", "FEVEREIRO", "MARÇO", "ABRIL", "MAIO", "JUNHO", "JULHO", "AGOSTO", "SETEMBRO", "OUTUBRO", "NOVEMBRO", "DEZEMBRO"};
  5.  
  6. int monthIndex = Integer.parseInt(monthNumber);
  7. String monthName = monthNames[monthIndex];
  8.  
  9. mes.setText(monthName);
  10.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement