- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Java Program to format date time with Join
To format date time with Join, set the date as a string and do not forget to add the delimeter.
For delimeter “/” in the date
String.join("/","11","11","2018");
For delimeter “:” in the date.
String.join(":", "10","20","20");
The following is an example.
Example
public class Demo { public static void main(String[] args) { String d = String.join("/","11","11","2018"); System.out.print("Date: "+d); String t = String.join(":", "10","20","20"); System.out.println("
Time: "+t); } }
Output
Date: 11/11/2018 Time: 10:20:20
Advertisements
To Continue Learning Please Login
Login with Google