Java - Format (Time to String)

Java Conceptuel Diagram

About

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

Example with the current date

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







Share this page:
Follow us:
Task Runner