Table of Contents

Java - Format (Time to String)

About

This page is a snippet on how to get a time as a string?

Example with the current date

String timeStamp = new SimpleDateFormat("yyyy.MM.dd_HH.mm.ss").format(new Date());
val timeInString = SimpleDateFormat("yyyy.MM.dd-HH.mm.ss").format(Calendar.getInstance().time);