Table of Contents

Scala FAQ: How do I get the current month as an integer or as a string in Scala?

In the following examples I show how to get the current month in Scala as a number (integer) and as a string, both as the month abbreviation and the full name of the month. In all of these examples I use Java classes like Calendar and SimpleDateFormat.

How to get the full month name

To get the full month name in Scala — i.e., January, February, March, etc. — use one of the following approaches. First, I found that you can get the full month name as a string without using SimpleDateFormat: