A little Scala “date” utilities class

Nothing major here today, but here’s some source code to start a little Scala “date utilities” class:

import java.text.SimpleDateFormat
import java.util.Calendar
import java.util.Date

object DateUtils {

    val DATE_FORMAT = "EEE, MMM dd, yyyy h:mm a"

    def getDateAsString(d: Date): String = {
        val dateFormat = new SimpleDateFormat(DATE_FORMAT)

    def convertStringToDate(s: String): Date = {
        val dateFormat = new SimpleDateFormat(DATE_FORMAT)
    def convertDateStringToLong(dateAsString: String): Long = {
    def convertLongToDate(l: Long): Date = new Date(l)
    def now(): Date = Calendar.getInstance.getTime


If you wanted to see how to do some things with dates in Scala, or otherwise want to start your own date utilities class, I hope this example source code is helpful.