You can use java.time.format.DateTimeFormatter.
https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html
Here there is an example
ZonedDateTime date = ZonedDateTime.now();
System.out.println(DateTimeFormatter.ofPattern("dd/MM/yyyy - hh:mm").format(date));
Related Contents:
- Is there any way to convert ZoneId to ZoneOffset in Java 8?
- How do I convert from int to String?
- A quick and easy way to join array elements with a separator (the opposite of split) in Java [duplicate]
- Best way to convert an ArrayList to a string
- Get string character by index
- How can I remove a substring from a given String?
- Bytes of a string in Java
- Converting Integer to String with comma for thousands
- How to check if my string is equal to null?
- Should I use string.isEmpty() or “”.equals(string)?
- Best way to concatenate List of String objects? [duplicate]
- Java String array: is there a size of method?
- How to remove newlines from beginning and end of a string?
- String isNullOrEmpty in Java? [duplicate]
- Strings are objects in Java, so why don’t we use ‘new’ to create them?
- Most efficient way to make the first character of a String lower case?
- Converting List to List
- How to extract numbers from a string and get an array of ints?
- How to get a string between two characters?
- How can I get a java.io.InputStream from a java.lang.String?
- How to upper case every first letter of word in a string? [duplicate]
- Check string for palindrome
- How to get the last characters in a String in Java, regardless of String size
- java: use StringBuilder to insert at the beginning
- Raw Strings in Java – for regex in particular. Multiline strings
- Correct way to use StringBuilder in SQL
- How to convert a Java String to an ASCII byte array?
- How could I split a String into an array in Kotlin?
- substring index range
- Check if enum exists in Java
- Bad idea to use String key in HashMap?
- String: How to replace multiple possible characters with a single character?
- Java 8 LocalDate – How do I get all dates between two dates?
- Remove trailing comma from comma-separated string
- Converting a sentence string to a string array of words in Java
- How can I parse a String to BigDecimal? [duplicate]
- Why does the Duration class not have ‘toSeconds()’ method?
- How can I left-align strings using String.format()?
- What is the best way to iterate over the lines of a Java String?
- How do I ignore case when using startsWith and endsWith in Java? [duplicate]
- Can one initialize a Java string with a single repeated character to a specific length [duplicate]
- The output -1 becomes a slash in the loop
- Efficient way to search a stream for a string
- Java 8 Time API: how to parse string of format “MM.yyyy” to LocalDate
- How to check if two words are anagrams
- Java change áéőűú to aeouu [duplicate]
- In Java, how to append a string more efficiently? [duplicate]
- Why does String.replace not work? [duplicate]
- What is the character encoding of String in Java?
- How to check if a date Object equals yesterday?