How can I convert a lowercase timestamp like โThu Jun 07 13:01:59 IST 2007โ to a date format in java ?
String ds = "Thu Jun 07 13:01:59 IST 2007"; SimpleDateFormat f = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy"); Date d = f.parse(ds);
As already mentioned, the answer is in the docs.
You can use DateFormat:
DateFormat dateFormat = new SimpleDateFormat("EM d HH:mm:ss z yyyy"); Date date = dateFormat.parse("Thu Jun 07 13:01:59 IST 2007");
First create a date and time pattern string as specified in the SimpleDateFormat javadocs, and then call parse to convert the string to a Date object.
SimpleDateFormat
parse
Date
Use SimpleDateFormat . Something like that:
DateFormat fmt = new SimpleDateFormat("EEE MMM d hh:mm:ss Z yyyy"); Date date = fmt.parse(str);
Source: https://habr.com/ru/post/1411246/More articles:Constraint ModelState.IsValid in ASP.NET MVC 3 - validationHow do I know if my Windows service is running? - c #asp.net mvc 3 serveride remote check does not work for sending through violinist - asp.net-mvcHandling iAd on iphone? - iosHow to redirect registration to akka? - scalaSpring 2 JDBC Data Source Configuration - springHow are ASPNNET CommandName and CommandArgument values โโstored? - c #How to cut the silence at the end of a wav file using Java? - javaIOS nested hierarchy to support drag and drop, allowing end users to customize forms - iosHow to track the sound zone in a wav file? - javaAll Articles