Question : date to string java
Answered by : colorful-cottonmouth-s96e89y9ybga
Date date = Calendar.getInstance().getTime(); DateFormat dateFormat = new SimpleDateFormat("yyyy-mm-dd hh:mm:ss"); String strDate = dateFormat.format(date);
Source : | Last Update : Fri, 01 May 20
Question : Date from String java
Answered by : fancy-flatworm-7imy9ovj7bjb
SimpleDateFormat formatter = new SimpleDateFormat("dd-MMM-yyyy", Locale.ENGLISH);
String dateInString = "7-Jun-2013";
Date date = formatter.parse(dateInString);
Source : https://www.baeldung.com/java-string-to-date | Last Update : Sun, 26 Jun 22
Question : java date to string
Answered by : hamza-naseer
Format formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String s = formatter.format(date);
Source : https://stackoverflow.com/questions/5683728/convert-java-util-date-to-string | Last Update : Tue, 08 Sep 20
Question : from date to string
Answered by :
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
try { Date date = new Date(); String dateTime = dateFormat.format(date); System.out.println("Current Date Time : " + dateTime);
} catch (ParseException e) { e.printStackTrace();
}
Source : https://stackoverflow.com/questions/8573250/android-how-can-i-convert-string-to-date | Last Update : Tue, 04 May 21
Question : java date to string and back
Answered by : inquisitive-iguana-j61las7qyq1h
{"tags":[{"tag":"textarea","content":"import java.util.Date;\nimport java.text.ParseException;\nimport java.text.SimpleDateFormat;\n\npublic static void main(String[] args) throws ParseException {\n Date d = new Date();\n String s = d.toString();\n Date theSameDate = new SimpleDateFormat(\"EEE MMM dd HH:mm:ss zzz yyyy\").parse(s);\n String dateBack = theSameDate.toString();\n\n System.out.println(\"Date to string: \" + s);\n System.out.println(\"String to date: \" + dateBack);\n}","code_language":"java"}]}
Source : https://stackoverflow.com/a/12574010/14456285 | Last Update : Wed, 29 Mar 23